A prompting option parser
Project description
Optprompt
A prompting option parser
Example
import optprompt
parser = optprompt.OptionPrompter(config_files=['./example.toml'])
parser.add_argument('-n', '--name', prompt='What is your name')
parser.add_argument('-r', '--race', prompt='What is your race', default='elf')
parser.add_argument('-e', '--edition')
opts = parser.parse_args()
print(opts)
With the config file
[defaults]
edition = '3.5'
Will produce the following output
(venv) [dylan@voyager examples]$ PYTHONPATH=$(pwd)/.. python example.py
What is your name : Bob
What is your race [elf]:
Namespace(edition='3.5', name='Bob', race='elf')
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
optprompt-0.5.0.tar.gz
(15.2 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
optprompt-0.5.0-py3-none-any.whl
(14.5 kB
view details)
File details
Details for the file optprompt-0.5.0.tar.gz.
File metadata
- Download URL: optprompt-0.5.0.tar.gz
- Upload date:
- Size: 15.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7430c7f59e34a1e6f8bec947c8e48fa0249fe2a0444e90cf7a20e67e11489057
|
|
| MD5 |
2a101a77197d2062e394f9385b6e6cea
|
|
| BLAKE2b-256 |
4e5fce7382fc335081a23dff308e05f4be8f559f006cfa85906f718698341785
|
File details
Details for the file optprompt-0.5.0-py3-none-any.whl.
File metadata
- Download URL: optprompt-0.5.0-py3-none-any.whl
- Upload date:
- Size: 14.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fad114a28b254039efa7214bee47457ba8c91cf1a35a23dc78b1f65aee6d4135
|
|
| MD5 |
a3b1f4b179f789c8c44ce2338cbb6d3c
|
|
| BLAKE2b-256 |
470c59cd4414b4f72b4e28cff53bc62b983f7ab290fd62a50a0a71a528d18af3
|