Closed cparlette closed 11 years ago
Check out the version action in argparse: http://docs.python.org/2.7/library/argparse.html#action
We could possibly condense this down into two lines by using the build in version action.
Also, we may want to load the version regardless of if the user requests a version or not, so if we need to use it elsewhere (like logging), we'll have it available.
I've read about using
with open('filename.txt'):
#do something
this would work better if someone deleted the version history file by accident.
@matthew-parlette So if I'm going to print the version every time (which I think is a good idea), should I even add the --version option?
I think so, it gives you the option of just outputting the version and exiting. I've used this with java before just to see what version I'm on before I do anything.
@matthew-parlette Try that latest commit, I think it's a little more sane.
Looks good. You may have said this before, but is version_history.txt created manually? or is there a way to pull in these items from github issues?
Manually for now, I think we can work on pulling it but it was a little more complex than I planned on getting for now.
I debated just printing the version all the time, but for now it just prints the version by reading the top line of version_history.txt if you specify the --version flag.