A python package for UNIX terminal utilities
pip install ers-terminal-utils
pip uninstall ers-terminal-utils
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)
)
- ChoicesViaTerminal: Create division to choice list.
- ChoicesViaTerminal: Create scrolling for large list.
- ChoicesViaTerminal: Predict O.S Windows and MacOS
This project is licensed under the MIT License - see the LICENSE page for details.