Skip to main content

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

This version

0.7

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

PromptInput-0.7.tar.gz (3.0 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page