Skip to main content

Simple command line interface library

Project description

clinterface

clinterface is a simple command line interface library to display tab-completion prompts and interactive menus.

Quick start

Import the module

from clinterface import prompts

Create a default Selector instance

selector = prompts.Selector()

or create a customized Selector instance

selector = prompts.Selector(
    shift = 1,
    indent = 3,
    align = 2,
    margin = 1,
    pad_left = 1,
    pad_right = 1,
    radiobullet = '*',
    checkbullet = '+',
)

Set the options and defaults from a list

selector.set_options([
    'Monday',
    'Tuesday',
    'Wednesday',
    'Thursday',
    'Friday',
    'Saturday',
    'Sunday',
])
selector.set_single_default('Friday')
selector.set_multiple_defaults(['Friday', 'Saturday', 'Sunday'])

or alternativey set the options and defaults from a dictionary

selector.set_options({
    'Mon':'Monday',
    'Tues':'Tuesday',
    'Wed':'Wednesday',
    'Thurs':'Thursday',
    'Fri':'Friday',
    'Sat':'Saturday',
    'Sun':'Sunday',
})
selector.set_single_default('Fri')
selector.set_multiple_defaults(['Fri', 'Sat', 'Sun'])

Prompt for a single choice

selector.set_message('Choose the best day of the week:')
selector.single_choice()

Prompt for multiple choices

selector.set_message('Choose the good days of the week:')
selector.multiple_choices()

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

clinterface-0.2.0-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

Details for the file clinterface-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: clinterface-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 11.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.10.0 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/1.0.0 urllib3/1.26.18 tqdm/4.64.1 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.8

File hashes

Hashes for clinterface-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cc6e8cbc40879654a8c7eece9158e43113df341427180d07448ee059562234b8
MD5 5e66f7b41ea53e6e3aad65559a33cf85
BLAKE2b-256 c5acb3e966ab21740157d0ec5b0e57c335f62396ea5a0a3bdcb354886409321e

See more details on using hashes here.

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