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.3.1.tar.gz
(2.2 kB
view hashes)
Built Distribution
Close
Hashes for optprompt-0.3.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8809c9dac35bdcaeee6975207ce7da5d8c763aedf862f10f57533f45295b5f30 |
|
MD5 | e214ee992dee040ec978c03afecd9935 |
|
BLAKE2b-256 | 5f168cae4ae344c16f62189a038525977150a2bcb03c02c6afd746c5c3874653 |