davetron5000 / gli

Make awesome command-line applications the easy way
http://davetron5000.github.io/gli
Apache License 2.0
1.26k stars 102 forks source link

app --version should not invoke default_command #206

Closed ddoherty03 closed 7 years ago

ddoherty03 commented 9 years ago

Dave,

I have an app with default command set to open up a shell from which other commands can be typed.

It's working fine, except that if I invoke 'app --version', I would expect the app to /not/ invoke the default command and simply report the version. 'app --help' works like this, just printing the help text without bringing up the shell afterwards. Seems 'app --version' should work the same way.

davetron5000 commented 9 years ago

I guess I didn't consider having a default command for the root level. Much of GLI assumes that you want a UI where the user specifies a command to run. Still, the behavior as it stands seems surprising.

ddoherty03 commented 9 years ago

Thanks, Dave. The pattern is like the ri command in ruby, or lvm, or mdadm. No args, and you go into a shell. I think its a useful default command. My app is an accounting app that has noticeable start up delay that is best avoided when you intend to issue several commands.