Skip to content

eliaquimrs/terminal-utils

Repository files navigation

terminal-utils

A python package for UNIX terminal utilities

Menu

Getting started

Installation

With public pip repository

pip install ers-terminal-utils

Uninstallation

pip uninstall ers-terminal-utils

Usage

Dynamic choices via terminal

Mode: one choice (Source Code)

from terminal_utils.choices_via_terminal import ChoicesViaTerminal

LIST_OF_CHOICES = [
    'Option 1',
    'Option 2',
    'Option 3',
    'Option 4',
    'Option 5'
]
TITTLE = 'Choose an option'
response = ChoicesViaTerminal(TITTLE, LIST_OF_CHOICES).main()
chosen_option_index, chosen_option_text = response[0]

print()
print('Chosen option index: {}\n'
      'Chosen option text: {}'.format(chosen_option_index, chosen_option_text))

Mode: Multiple choices (Source Code)

from terminal_utils.choices_via_terminal import ChoicesViaTerminal

LIST_OF_CHOICES = [
    'Option 1',
    'Option 2',
    'Option 3',
    'Option 4',
    'Option 5'
]
TITTLE = 'Choose one or more options'
response = ChoicesViaTerminal(TITTLE, LIST_OF_CHOICES,
                              mode='multiple_choices').main()

print('')
for chosen_option_index, chosen_option_text in response:
    print(
        '- Chosen option index: {}|Chosen option text: {}'.format(chosen_option_index,
                                                                  chosen_option_text)
    )

TODO List

  • ChoicesViaTerminal: Create division to choice list.
  • ChoicesViaTerminal: Create scrolling for large list.
  • ChoicesViaTerminal: Predict O.S Windows and MacOS

LICENSE

This project is licensed under the MIT License - see the LICENSE page for details.

License MIT