API Reference
Paperbush
Creates a Paperbush parser; takes a string pattern written in the Paperbush custom language, an arbitrary number of reference values, and theinfer_names
flag which
specifies whether arguments with only long names should have the short names
inferred (True
by default).
Warning
Keeping infer_names
true is going to cause name collisions between
arguments which start with the same letter (for example
Paperbush("--fix --force")
).
Paperbush.from_iterable
Creates a Paperbush parser from an iterable of patterns.Example
Paperbush.from_mapping
Creates a Paperbush parser from a mapping, where keys are patterns and values are help messages.Paperbush.parse
Parses command line arguments using the predefined pattern and returns an
argparse.Namespace
object. Accepts either a list of strings or a single string (which is split
with shlex.split
).
Paperbush.parse_args
Equivalent toPaperbush.parse(sys.argv)
.