Skip to main content

A prompting option parser

Project description


A prompting option parser


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()

With the config file

edition = '3.5'

Will produce the following output

(venv) [dylan@voyager examples]$ PYTHONPATH=$(pwd)/.. python
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.4.0.tar.gz (2.3 kB view hashes)

Uploaded source

Built Distribution

optprompt-0.4.0-py3-none-any.whl (5.4 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page