✨A powerful tool to replace getopt✨
Project description
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
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
checkopt-1.0.0.tar.gz
(6.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file checkopt-1.0.0.tar.gz.
File metadata
- Download URL: checkopt-1.0.0.tar.gz
- Upload date:
- Size: 6.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0217e9fd2b63731dfc6776d1fd44ef9bdb8e71b17b4555136fca76969e982b7d
|
|
| MD5 |
4442d99a4df0de7be195413746c52fd0
|
|
| BLAKE2b-256 |
dfde4b8a7ea359a6fcfe08275cb2877bc3febe42d3a8062f7b53fb2cf46d2cb6
|
File details
Details for the file checkopt-1.0.0-py3-none-any.whl.
File metadata
- Download URL: checkopt-1.0.0-py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
39780f6495135c5ca5aa88aac8c03f63592cdc0d1d9c0126303b67bfa876711e
|
|
| MD5 |
bfe20319e91ae13d99bface759794410
|
|
| BLAKE2b-256 |
f3c0e0c45ab8fbe8107c0656f572c6e78e7896534eb77d5aef97d5dcd21ad867
|