the-xkcd-community / the-red-spider-project

Coding and xkcd combined, for fun!
http://the-xkcd-community.github.com/the-red-spider-project
Other
40 stars 33 forks source link

Creto #42

Open JonETMeans opened 11 years ago

JonETMeans commented 11 years ago

Here's what I've got now. Type "git-creto" to get a new branch. It seems to me like the only way to make a command allowing the user to input the name would be to somehow make part of the file name act as a variable.

jgonggrijp commented 11 years ago

Ah, I see your problem. Creating a new subcommand for git isn't that easy, you still have to write an actual program. And since an actual program can accept command line arguments you can also have it accept a name for the topic branch. Consider something along the following lines (example written in Python, but you can pick another language if you want):

import subprocess
import sys
subprocess.call(['git', 'checkout', 'master'])
subprocess.call(['git', 'puma'])
subprocess.call(['git', 'checkout', '-b', sys.argv[1]])

Of course this would need some sophistication to make it a neat program, but you probably get the idea.

As a side note, you have now demonstrated to yourself why you need to create a new branch before you start working on something new. This pull request can be granted only when your git-creto command is done and when your random-number command is done. Keeping them on separate branches (not one branching off the other but both branching directly from the integration branch) would have saved you that trouble. ;-)

Speaking of which, did you see my pull request on your repo? That should finish the random-number stuff, if you accept it.

JonETMeans commented 11 years ago

I guess I just have to keep reminding myself that if I can imagine a thing, it's probably possible somehow. So many libraries....

Anyway, thanks for the help! I'll get right on figuring this out.