command line parsing library
Project description
optmatch - Library to allow an easy and effective parsing of command line options.
Full documentation: http://coderazzi.net/python/optmatch
optmatch is based on expressing the actions -with all options and related flags- that are supported, instead of just listing all possible argument flags.
For example:
class Example(OptionMatcher):
@optset
def handle_common_flag(self, mail_option):
…
@optmatcher
def handle_compression(self, filename, compress_flag =False):
…
@optmatcher(flags=’verbose’, options=’mode’)
def handle(self, filename, verbose=False, mode=’simple’, where=None):
…
In this example:
It is defined a common flag (–mail)
It is defined an action, supporting a –compress flag which is False by default, and requiring a filename parameter
It is defined a second action, supporting a –verbose flag and a –mode option, requiring one or two file locations.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file optmatch-0.9.2.tar.gz
.
File metadata
- Download URL: optmatch-0.9.2.tar.gz
- Upload date:
- Size: 15.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6b64f8b3b7125fdbdf732dba819ac44c7224a290a912214484c57914fa4c6bc0 |
|
MD5 | a94b4430360d501db71e447b4a6256ec |
|
BLAKE2b-256 | b14bdcdeafef5c57cea25466aec792a54cdc1d28ab14d3d20777a898229573df |