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
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
dirtyopts-0.0.20.tar.gz
(4.3 kB
view hashes)