A python library build over argument parser to prompt user for input.
Project description
PromptInput
Take command line input using Prompt
PromptInput is a python library built on top of "argparse".It allows you to ask for inputs from user with the relevant help text whenever you miss to pass that input with command.
Features
- You don't need to worry about remembering the order of input anymore.
- PromptInput will ask for any input that you miss.
- By passing the default value you can also make an argument optional.
Tech
PromptInput just uses built in argparse module of python and do not have any other dependency.
And of course Dillinger itself is open source with a public repository on GitHub.
Installation
Dillinger requires Python v3.6+ to run.
Install the library using pip.
pip install PromptInput
Usage
Import PromptInput in your script.
from PromptInput import PromptInput
Make an object of PromptInput class.
parser = PromptInput()
Call add_argument method and pass all these arguments accoring to usage.
parser.add_argument('var1', type=str, nargs='?',
help='Enter var 1',default = "demo",count = 1,required = True)
count
It is passed with every argument to specify the position of a particular argument. It is used to later prompt the help for the correct input.
required
It is only passed if the argument is required and there is no default value present and you want the user to input it in case it is left blank with command.
Calling parse_args method to get a namespace containing all the arguments
args = parser.parse_args()
print(args.var1)
License
MIT
Free Software, Hell Yeah!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file PromptInput-0.7.tar.gz
.
File metadata
- Download URL: PromptInput-0.7.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.8.3 pkginfo/1.8.2 requests/2.23.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c166db24e8c0805ca9633cc9b44e6df1108d41f8a66f9a4358bbfaf1f3c2b760 |
|
MD5 | ead300cfb36e8aca0c9a5095a04787cc |
|
BLAKE2b-256 | e02650e6c7f3ad7b150bd803c87e8b694b94eae96c385db66ea22c9c237456bb |