Skip to main content

optmatch - Library to allow an easy and effective parsing of command line options.

Full documentation: https://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:

  1. It is defined a common flag (–mail)

  2. It is defined an action, supporting a –compress flag which is False by default, and requiring a filename parameter

  3. It is defined a second action, supporting a –verbose flag and a –mode option, requiring one or two file locations.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

optmatch-1.0.0.tar.gz (15.6 kB view details)

Uploaded Source

File details

Details for the file optmatch-1.0.0.tar.gz.

File metadata

  • Download URL: optmatch-1.0.0.tar.gz
  • Upload date:
  • Size: 15.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2

File hashes

Hashes for optmatch-1.0.0.tar.gz
Algorithm Hash digest
SHA256 4bb92c1cb121d9af00958f49da764befb86bf5ccec98aec6261e9a180f9d18a0
MD5 bd785ed17dbaa3e09ebdfaace604fbb0
BLAKE2b-256 9fdb536f0cd5bf9cc846a76a4741b2bd122179f7ac34b69ebd32759d66ececa4

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.0.0 This release

1 file

0.9.2

1 file

0.9.1

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page