https://github.com/dogoncouch/lightcli
A Python 3 library module for lightweight terminal interaction.
https://github.com/dogoncouch/lightcli
cli cli-utilities input-method input-validation python-3 python-library python3 python3-library
Last synced: 4 months ago
JSON representation
A Python 3 library module for lightweight terminal interaction.
- Host: GitHub
- URL: https://github.com/dogoncouch/lightcli
- Owner: dogoncouch
- License: mit
- Created: 2017-03-21T23:27:37.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-04-30T02:49:55.000Z (about 7 years ago)
- Last Synced: 2025-02-12T06:53:29.448Z (5 months ago)
- Topics: cli, cli-utilities, input-method, input-validation, python-3, python-library, python3, python3-library
- Language: Python
- Homepage:
- Size: 32.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# lightcli
A Python 3 library module for lightweight terminal interaction## Index
- [Installing](#installing)
- [Introduction](#introduction)
- [Functions](#functions)
- [Copyright](#copyright)## Installing
See the latest instructions on the [releases page](https://github.com/dogoncouch/lightcli/releases).# Introdutcion
## Synopsis
import lightcli
choice = lightcli.choice_input([options=], [prompt=], [showopts={True|False}], [qopt={True|False}])
multiline = lightcli.long_input([prompt=])
mylist = lightcli.list_input([prompt=])
outputfile = lightcli.outfile_input([extension=])## Description
lightcli is a Python 3 module for lightweight terminal interaction.# Functions
### lightcli.choice\_input([options=\], [prompt=\], [showopts={True|False}], [qopt={True|False}])
Options:
- `` options `` - list of acceptable answers (list of strings)
- `` prompt `` - text shown when asking for input (a string)
- `` showopts `` - toggles display of options list (default is True)
- `` qopt `` - toggles a 'q to quit' option (default is False)Prompts for and returns input from a list of choices.
### lightcli.long\_input([prompt=\], [maxlines=\], [maxlength=\])
Options:
- `` prompt `` - text shown when asking for input (a string)
- `` maxlines `` - sets the maximum number of lines
- `` maxlength `` - sets the maximum line lengthGets a multi-line string as input. Entering an EOF on a blank line ends the input (ctrl-D in \*nix, ctrl-Z in Windows).
### lightcli.list\_input([prompt=\], [maxitems=\], [maxlength=\])
Options:
- `` prompt `` - text shown when asking for input (a string)
- `` maxitems `` - sets the maximum number of items
- `` maxlength `` - sets the maximum item lengthGets a list of strings as input. Each item is entered on a separate line; entering an EOF on a blank line ends the input (ctrl-D in \*nix, ctrl-Z in Windows).
### lightcli.outfile\_input([extension=\])
Options:
- `` extension `` - sets the file extensionReturns the name of a writeable output file.
# Copyright
MIT LicenseCopyright (c) 2017 Dan Persons ([email protected])
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.