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

Uploaded Python 3

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