Argument Parsing for Humans
Processing command line arguments might seem like a very simple task (and relative to big problems it is), but there is still a considerable amount of edge cases to cater for. Trust me, I was one of the developers of the Commons CLI library and there was way more work in that than I imagined.
However, more often than not, the command line programs I write, have a very basic argument structure. Libraries like optparse and argparse provide unnecessary features, while processing
sys.argv is too brittle, for cases like this.
args can parse this command:
program -i infile --output outfile -v=3
import args infile = args.grouped['-i'] outfile = args.grouped['--output'] verbosity = args.assignments['-v']
and a command that performs an action on a list of PNG files:
import args for filepath in args.files: # do something with the filepath