I've written a command line tool and I want it to print out the current version of the program if I type in the --version
command. I've got a git repository setup for my program so I figured maybe I could somehow hook into that to get version information from tags or something?
What happens when I type in program --version
into my terminal? Presuming I have some kind of flag parser setup where I can check that the version flag is present, how do I handle this?
The only way I can think of doing this right now is with a simple hard-coded value e.g. #define VERSION "0.0.1"
, but I'm sure we can do better than that, right?