-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Separate subcommand parsing from subcommand main
Each subcommand implements a create_subcmd_parsers() function that receives the parent parser and adds its own parsing subcommands and options. The main() function of each subcommand receives the top level parsed 'args' object and uses it as it did previously. Old subcommand main() flow: 1. Define parser 2. Define subparsers 3. Parse args 4. Use args to call functions and pass args. New top-level command main() flow: 1. Define top level parser 2. Define subcommand names 3. Pass subcommand parser to each subcommand 'create_subcommand_parsers()' 3.1 Each subcommand defines its subparser 4. Parse args 5. Use args to call subcommand and pass args to subcommand main() 5.1 Subcommand main() uses args to call appropriate function and validate options.
- Loading branch information
1 parent
34df252
commit dea9a8f
Showing
4 changed files
with
20 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters