Skip to main content

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)

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.

Release history Release notifications | RSS feed

This release

0.0.20 This release

1 file

0.0.18

1 file

0.0.17

1 file

0.0.15

1 file

0.0.13

1 file

0.0.12

1 file

0.0.11

1 file

0.0.10

1 file

0.0.9

1 file

0.0.6

1 file

0.0.5

1 file

0.0.4

1 file

0.0.3

1 file

0.0.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