use argparse to parse cli arguments #2

Merged
merged 1 commit into from Jul 24, 2014

Projects

None yet

2 participants

@nathantypanski
Contributor

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
@nathantypanski nathantypanski use argparse to parse cli arguments
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.
0ddff76
@michaelsproul michaelsproul merged commit 2486146 into michaelsproul:master Jul 24, 2014
@michaelsproul
Owner

Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment