Skip to content

Refactor command line argument parsing#19

Open
FMeinicke wants to merge 1 commit into
Jvanrhijn:masterfrom
FMeinicke:master
Open

Refactor command line argument parsing#19
FMeinicke wants to merge 1 commit into
Jvanrhijn:masterfrom
FMeinicke:master

Conversation

@FMeinicke

Copy link
Copy Markdown
Contributor

When I did my last pull request I noticed some weird usage of argparse's `add_argument' kwargs.

Parsing of command-line arguments is now done in a separate function
which returns the parsed arguments. Additionally, most of the
add_argument calls are now using the correct way to display help
about what the argument is doing. Previously the metavar kwarg was
used and not the help kwarg. I added some additional information
where I thought the current help message was not enough (e.g. for the
play_pause indicator it is really helpful to know that the argument
expects a command separated string where 'play' comes first and 'pause'
comes second.) Also, I added default values where possible to remove
the kind of boilerplate code that checked if the command line
argument is present and if so replaced a default value. This is now
handled by argparse using the default kwarg.

Parsing of command-line arguments is now done in a separate function
which returns the parsed arguments. Additionally, most of the
`add_argument` calls are now using the correct way to display help
about what the argument is doing. Previously the `metavar` kwarg was
used and not the `help` kwarg. I added some additional information
where I thought the current help message was not enough (e.g. for the
play_pause indicator it is really helpful to know that the argument
expects a command separated string where 'play' comes first and 'pause'
comes second.) Also, I added default values where possible to remove
the kind of boilerplate code that checked if the command line
argument is present and if so replaced a default value. This is now
handled by argparse using the `default` kwarg.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant