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.3.0.tar.gz
(2.3 kB
view hashes)
Built Distribution
Close
Hashes for optprompt-0.3.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cb9dce2aa0fe9c0b8d2d604d9a2fb5cc42327e4155337d4b89c02578496a3a98 |
|
MD5 | 8253f41b176c8f7e2eb54cb9b7cfbd26 |
|
BLAKE2b-256 | db777fa73630fa0e790906f92dad4744c788e8ab4cae928fe5903cb2f61046f8 |