Skip to main content

Simple Python Prompt

Project description

Python Zompt

zompt is library for generating user input prompts for Python clis.

Zompt features

  • Text input prompt
  • Multiple choice prompt (using arrow keys)

Installation

pip install zompt

Getting Started

Input Prompt

The most simple example of the Input Prompt would look like this:

if __name__ == "__main__":
    print("Example prompt (type some text): ")
    input_prompt = InputPrompt()
    result = input_prompt.run()
    print()
    print("You typed: " + result)

Multiple Choice Prompt

The most simple example of a mupltiple choice prompt would look like this:

if __name__ == "__main__":
    if(len(sys.argv) < 2):
      print("No arguments given, include at least two commandline arguments.")
      sys.exit(1)

    options = []
    for index in range(1, len(sys.argv)):
      arg = sys.argv[index]
      options.append(arg)

    print("Select an option (use arrow keys to change selection, press enter when done): ")
    arrow_selection_prompt = ArrowSelectionPrompt(options)
    result = arrow_selection_prompt.run()
    print()
    print()
    print("You selected: " + result)

Philosophy

Sometimes for CLIs less is more. Providing users with a simplified prompting mechanism will help guide them through complex scenarios but with an easy to use interface.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

zompt-0.1.0-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file zompt-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: zompt-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.0.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for zompt-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 680c786ed0460b80435ff3d0a84d5acf945a576e0209755a58ffcc4ef6487117
MD5 a228a4a20697142028bdf5bd1437911a
BLAKE2b-256 2620c00709c621fb6a3aa47c0794c8c22580a52ba677cf7eb3b3e2c020621c7b

See more details on using hashes here.

Supported by

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