This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author G2P
Recipients G2P, bethard, elsdoerfer, eric.araujo, nvie, r.david.murray
Date 2010-11-15.23:23:49
SpamBayes Score 1.2695776e-06
Marked as misclassified No
Message-id <>
Trying to spec this, here is a proposed API:

    parser = argparse.ArgumentParser()
    sub = parser.add_subparsers(default='show')
    sub_show = sub.add_parser('show')
    sub_add = sub.add_parser('add')

If default isn't passed, the subcommand isn't optional.
If default is passed, and no explicit subcommand is given,
the default subcommand is picked.
Arguments are given to the top parser; passing arguments
to the subcommand requires naming it explicitly.

As far as motivation, I'd like to change a program that
uses --choice options (that can have a default) to use
more expressive subcommands. Some programs rely on implicit
subcommands a lot; the ip command on linux is a good
Date User Action Args
2010-11-15 23:23:51G2Psetrecipients: + G2P, bethard, eric.araujo, r.david.murray, nvie, elsdoerfer
2010-11-15 23:23:51G2Psetmessageid: <>
2010-11-15 23:23:49G2Plinkissue9253 messages
2010-11-15 23:23:49G2Pcreate