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', opt_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.2.0.tar.gz
(2.2 kB
view hashes)
Built Distribution
Close
Hashes for optprompt-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c950c2027812b337f4e2574a9125acf0d52dbf6a95afa3b58dd08eaf44bcbc7d |
|
MD5 | 7a5d4cc830505f459b0b1d8f6db9beef |
|
BLAKE2b-256 | 0076684622f6d0aa176e30e1b2d69a1be13e8143cc34f27538e8a915b7d0da8a |