Simple utility functions for command-line applications.
Project description
This is a package containing utility functions for command-line applications.
Features
Inputting an integer, float or boolean
Selecting from a list of options (by entering an integer or character)
Goals
Simplicity: Straightforward, high-level functions with sensible defaults. Most parameters are optional, so you can hit the ground running.
Flexible: An extensive range of options are provided, making the library useful in a wide range of situations.
Installation
Install as usual:
pip install ruben-console-utilities
You may wish to create a virtual environment beforehand.
Usage
Here a few examples:
>>> import consoleutilities as cu
>>> cu.input_option_int(["Export as PDF", "Export as HTML", "Export as TeX"])
[0]: Export as PDF
[1]: Export as HTML
[2]: Export as TeX
Enter integer [0..2]: >? 0
0
>>> cu.input_int("Pick a number between 1 and 10: ", 1, 10, include_max=True)
Pick a number between 1 and 10: >? 8
8
>>> cu.input_boolean("Specify whether to trust this host")
Specify whether to trust this host [y/N]: >? abc123
False
>>> cu.input_boolean("Specify whether to enable HTTPS", default=True)
Specify whether to enable HTTPS [Y/n]: >?
True
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ruben-console-utilities-0.3.0.tar.gz.
File metadata
- Download URL: ruben-console-utilities-0.3.0.tar.gz
- Upload date:
- Size: 8.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2088803b9c462ce3f6fd27044adf9cffb3e2457176e1326b1b5c1ea4ef2623f6
|
|
| MD5 |
075e36e7f417b2b9172250aa840bba2a
|
|
| BLAKE2b-256 |
5e0d477c5ff38dceab311d16193fe9bfb9354c291405ba4cc2a260a679e3fad8
|
File details
Details for the file ruben_console_utilities-0.3.0-py3-none-any.whl.
File metadata
- Download URL: ruben_console_utilities-0.3.0-py3-none-any.whl
- Upload date:
- Size: 8.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
42263b50f64a16e7574db62fc94c9f172ab34882e11c7292cd5c523090166081
|
|
| MD5 |
cf0df54a324c64bfae9d7486f254e256
|
|
| BLAKE2b-256 |
2773ef29cd0534e2b55159a4e35edab1bd96cbacb53855cf063064535dd25577
|