Skip to main content

another opts parser

Project description

Install:

pip install dirtyopts

Usage:

from dirtyopts import parse

doc = '''
#--NAMEOFTHING TYPE[+ for list] [DEFAULT] [assert ALLOWED VALUES]  [comment after 2 spaces :)]
--intarg int+ 3 4 5  i am a comment
--mystring str be assert mystring musst be one of these

# no default value means the default of the type
--strarg str  ->''


'''

other_behaviour = '''
# you can parse the args with multiple doc strings, as unknown args are ignored
--intarg2 int

# -h and --help will print this string

# giving w1 as first arg will trigger verbose mode for the parsing

# you need to provide a string for bool arguments because where is no special treatment for them
>>>myprog --boolarg True
'''

args = parse(doc)
args2 = parse(other_behaviour)

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

dirtyopts-0.0.20.tar.gz (4.3 kB view details)

Uploaded Source

File details

Details for the file dirtyopts-0.0.20.tar.gz.

File metadata

  • Download URL: dirtyopts-0.0.20.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for dirtyopts-0.0.20.tar.gz
Algorithm Hash digest
SHA256 aa03ff79301672182d7181213ea49ff26f16309bc7584d6bf821f89877d23dfa
MD5 9947af9ee213c5e904604b7979b777a3
BLAKE2b-256 459c2d917eb784173a80a3f9193b796a1600608dbfadfca3b937b69ff3a504d0

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