Skip to content

Commit

Permalink
simplify add subparser
Browse files Browse the repository at this point in the history
  • Loading branch information
nsheff committed Jun 11, 2019
1 parent c34db26 commit 069de23
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions divvy/compute.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,18 +301,12 @@ def main():

subparsers = parser.add_subparsers(dest="command")


def add_subparser(cmd):
# Individual subcommands
msg_by_cmd = {
"list": "List available compute packages",
"write": "Write a submit script"
}
def add_subparser(cmd, description):
return subparsers.add_parser(
cmd, description=msg_by_cmd[cmd], help=msg_by_cmd[cmd])
cmd, description=description, help=description)

write_subparser = add_subparser("write")
list_subparser = add_subparser("list")
write_subparser = add_subparser("write", "Write a submit script")
list_subparser = add_subparser("list", "List available compute packages")

write_subparser.add_argument(
"-S", "--settings",
Expand Down

0 comments on commit 069de23

Please sign in to comment.