Jaymon / captain

command line python scripts for humans
MIT License
13 stars 1 forks source link

Add the possibility to remove the `-Q, --quiet` and `-q` options #42

Closed rubik closed 6 years ago

rubik commented 6 years ago

Thanks for the amazing library!

I would like to have the possibility to remove the above mentioned options. A few of my programs need those. Maybe this can be accomplished with an argument to captain.exit?

Jaymon commented 6 years ago

Instead of passing them in just go ahead and override them:

from captain import arg, exit, echo

@arg('--quiet', '-Q', '-q', action='store_true', help='override quiet')
def main(quiet):
    echo.out(quiet)

exit(__name__)

It will no longer set any of the three flags (--quiet, -Q, or -q) if you override them, you can override any combination of them also, so if you override --quiet then -Q will still have the built in functionality.

Hope that gets you what you need :)