Skip to main content

pretty good command-line option parser

Project description

Cmdopt.py is command-line option parser for Python.

Example:

import sys, cmdopt
## create parser
parser = cmdopt.Parser()
## define options
parser.option("-h, --help",       "show help")
parser.option("-f, --file=FILE",  "read file")
parser.option("-i, --indent=N",   "indent width")\
      .validation(lambda val: not val.isdigit() and "integer required.")\
      .action(lambda val, opts: setattr(opts, 'indent', int(val)))
## parse args
args = sys.argv[1:]
opts = parser.parse(args)    # may raise cmdopt.ParseError
if opts.help:
    print(parser.help())     # or parser.help(width=15, indent="  ")

Features:

  • Validator

  • Handler

  • Help message

  • Multiple option

See README for details.

Project details


Download files

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

Source Distribution

Cmdopt-0.2.0.tar.gz (9.7 kB view details)

Uploaded Source

Built Distributions

Cmdopt-0.2.0-py3.2.egg (7.0 kB view details)

Uploaded Source

Cmdopt-0.2.0-py3.1.egg (7.0 kB view details)

Uploaded Source

Cmdopt-0.2.0-py3.0.egg (7.0 kB view details)

Uploaded Source

Cmdopt-0.2.0-py2.7.egg (7.0 kB view details)

Uploaded Source

Cmdopt-0.2.0-py2.6.egg (7.0 kB view details)

Uploaded Source

Cmdopt-0.2.0-py2.5.egg (7.0 kB view details)

Uploaded Source

Cmdopt-0.2.0-py2.4.egg (7.1 kB view details)

Uploaded Source

File details

Details for the file Cmdopt-0.2.0.tar.gz.

File metadata

  • Download URL: Cmdopt-0.2.0.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for Cmdopt-0.2.0.tar.gz
Algorithm Hash digest
SHA256 7cafc9dd63e48d8fa0a184417fe6e741bba693ac24928248040a7041cb8b403a
MD5 0b1a2d36e9466e8727ce30965205694e
BLAKE2b-256 1d0c1b1b99e21a63cb7a2c5256a00dc1972891727c5db03cb3b5a00b3100ab77

See more details on using hashes here.

File details

Details for the file Cmdopt-0.2.0-py3.2.egg.

File metadata

  • Download URL: Cmdopt-0.2.0-py3.2.egg
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for Cmdopt-0.2.0-py3.2.egg
Algorithm Hash digest
SHA256 79587caa05b7204dec893d11dc2574af766168e7bc24bf62c2ca29864335921b
MD5 5212d3eb2b30afbe58bd65b1e8c96857
BLAKE2b-256 4a842d583f6b9b5a62e421989ecee2ea4503a1d96409488b8d6be18e7be0e63c

See more details on using hashes here.

File details

Details for the file Cmdopt-0.2.0-py3.1.egg.

File metadata

  • Download URL: Cmdopt-0.2.0-py3.1.egg
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for Cmdopt-0.2.0-py3.1.egg
Algorithm Hash digest
SHA256 68e0fa24079c18e6225faeebbfd8033b4eb01a730089828cc183204f842b32ed
MD5 44e2e8833aa57a6907a88a1f720e6a25
BLAKE2b-256 8c44e497534f5ae8ea28dbbfd2780abe7c043f90be94a0d5b61bb8a6b48b68c2

See more details on using hashes here.

File details

Details for the file Cmdopt-0.2.0-py3.0.egg.

File metadata

  • Download URL: Cmdopt-0.2.0-py3.0.egg
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for Cmdopt-0.2.0-py3.0.egg
Algorithm Hash digest
SHA256 8af47ae2248e819fcc2fe366205285a39411918ae2c21b5aea5b5f5c321fcc5d
MD5 dad880fa751e1f9d5a67bcf0e093a7f0
BLAKE2b-256 4998e339a35f26ed876257f18dcc22458c953fee34e251a82418b001bcaab4a0

See more details on using hashes here.

File details

Details for the file Cmdopt-0.2.0-py2.7.egg.

File metadata

  • Download URL: Cmdopt-0.2.0-py2.7.egg
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for Cmdopt-0.2.0-py2.7.egg
Algorithm Hash digest
SHA256 8d718fc28b942ccf65ccdeaa6e6dc11ef32f921fd15eb4529139ee4d82992296
MD5 a9f4e09c24138e57c462ab422d98a1db
BLAKE2b-256 dff63d8c787047904afd731a0abdb077431a3a365d0236c7eff37ea0d832e5b4

See more details on using hashes here.

File details

Details for the file Cmdopt-0.2.0-py2.6.egg.

File metadata

  • Download URL: Cmdopt-0.2.0-py2.6.egg
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for Cmdopt-0.2.0-py2.6.egg
Algorithm Hash digest
SHA256 8c5a918166ea76290bf64ba7f1efe427d091050f6340b2a7d2040910f98d9db0
MD5 331cac9c624f8ccf56a6efa9024129aa
BLAKE2b-256 247059099224700bcb47662d55ebfe028b242b21a1ab8d5f6b51c21c7e19e657

See more details on using hashes here.

File details

Details for the file Cmdopt-0.2.0-py2.5.egg.

File metadata

  • Download URL: Cmdopt-0.2.0-py2.5.egg
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for Cmdopt-0.2.0-py2.5.egg
Algorithm Hash digest
SHA256 2baf74e08b398054f275e09755d7fda0ab0aeb933d0195808e24d360c139ddba
MD5 1dd6927d549fe6a75a2b47973f678ce7
BLAKE2b-256 8150076f9fbf25568b52c88ce07afed774f10d87c3cf24c73a2b56ebd7546327

See more details on using hashes here.

File details

Details for the file Cmdopt-0.2.0-py2.4.egg.

File metadata

  • Download URL: Cmdopt-0.2.0-py2.4.egg
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for Cmdopt-0.2.0-py2.4.egg
Algorithm Hash digest
SHA256 bd38ea4b82472f20513f13172f8bb628d02736a3185f19d78082329975959f9b
MD5 649cede76c532c63a9d5443f9f22965a
BLAKE2b-256 fc55e15a3c7f531da34e35705141e1ada01f9c5f53e0f2922fa7ddd0acc0343e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page