Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use argparse to parse cli arguments #2

Merged
merged 1 commit into from Jul 24, 2014

Conversation

@nathantypanski
Copy link
Contributor

@nathantypanski nathantypanski commented Jul 24, 2014

Using Python's argparse makes the script's help text better: it's more
detailed and gives the user descriptions for their input. It gives you
consistent internal naming, while letting you change the UI, and it's a
standardized feature across Python packages.

Example usage:

rust-nightly-archlinux$ ./make_pkgbuild.py
usage: make_pkgbuild.py [-h] pkgbuild_template rust_makefile
make_pkgbuild.py: error: the following arguments are required: pkgbuild_template, rust_makefile
rust-nightly-archlinux$ ./make_pkgbuild.py -h
usage: make_pkgbuild.py [-h] pkgbuild_template rust_makefile

PKGBUILD generator for Rust nightly

positional arguments:
  pkgbuild_template  path to PKGBUILD template
  rust_makefile      path to Rust makefile

optional arguments:
  -h, --help         show this help message and exit
Using Python's argparse makes the script's help text better: it's more
detailed and gives the user descriptions for their input. It gives you
consistent internal naming, while letting you change the UI, and it's a
standardized feature across Python packages.
michaelsproul added a commit that referenced this issue Jul 24, 2014
Use argparse to parse CLI arguments.
@michaelsproul michaelsproul merged commit 2486146 into michaelsproul:master Jul 24, 2014
@michaelsproul
Copy link
Owner

@michaelsproul michaelsproul commented Jul 24, 2014

Cheers!

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants