@command
def main(two=False):
"""usage: main [options]
-2, --two This option has two variants.
"""
Options map to function arguments via the long option name.
@command
@coerce(two=bool)
def main(two=False):
"""usage: main [options]
-2, --two This option has two variants.
"""
# Parse sys.args and call unconditionally
main.parse_args()
# Parse passed args
main.parse_args(args)
# Noop unless called in main script
main.parse_args(if_main=__name__)
@command
@commit.bind
@update.bind
def main():
"""usage: ./script [program options] <command> [options]...
commit, ci
commit the specified files or all outstanding changes
update, up
update working directory (or switch revisions)
"""
… and allow multiple commands in a row …
./script ci -m "did stuff" up