Skip to main content

quick start

import checkopt  
print(checkopt.checkopt("g help m|module="))

(venv) PS D:\python> python .\test.py -m module_name --help -g project_name
({'m': 'module_name', 'help': None, 'g': None}, ['project_name'])
r = checkopt.checkopt("m|module=* f=")
(venv) PS D:\python> python .\demo.py -m module_name1 -m module_name2 extra_data -f 123
({'module': ['module_name1', 'module_name2'], 'f': '123'}, ['extra_data'])

argument format

short_opts|long_opts=* =means the option receives an argument * means the option allows multiple arguments and the corresponding data will be a string list while space is the char to split to option pattern

advantages

code:

print(getopt.getopt(sys.argv[1:], "m:h")) 
print(checkopt.checkopt("m= h|help"))

(venv) PS D:\WorkSpace\python> python .\container_update.py -h file -m abc 

result:

([('-h', '')], ['file', '-m', 'abc']) # getopt
({'h': None, 'm': 'abc'}, ['file'])   # checkopt

Release files for checkopt 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for checkopt 1.0.0
File Size Uploaded
checkopt-1.0.0.tar.gz 6.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for checkopt 1.0.0
File Interpreter ABI Platform
checkopt-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 13.6 kB

Release files / checkopt-1.0.0.tar.gz

Download URL checkopt-1.0.0.tar.gz
Size 6.7 kB
Tags Source
SHA-256 checksum
How to use checksums
0217e9fd2b63731dfc6776d1fd44ef9bdb8e71b17b4555136fca76969e982b7d
BLAKE2b-256 checksum
How to use checksums
dfde4b8a7ea359a6fcfe08275cb2877bc3febe42d3a8062f7b53fb2cf46d2cb6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release files / checkopt-1.0.0-py3-none-any.whl

Download URL checkopt-1.0.0-py3-none-any.whl
Size 6.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
39780f6495135c5ca5aa88aac8c03f63592cdc0d1d9c0126303b67bfa876711e
BLAKE2b-256 checksum
How to use checksums
f3c0e0c45ab8fbe8107c0656f572c6e78e7896534eb77d5aef97d5dcd21ad867
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.1.1

2 release files

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