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.1.tar.gz
(2.2 kB
view hashes)
Built Distribution
Close
Hashes for optprompt-0.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bf190920f5ffdadc3a9386175bf9ed8bdaa451174abd4cbd0aeda81707b89772 |
|
MD5 | ca8f4433ee60fbde0bbbf2deee8abc2d |
|
BLAKE2b-256 | fb8768fb80d7bafb7d6e0cdfc1baac4030c4e35b72d8f9f9060461ffa87a960f |