Simple utility functions for command-line applications.
Project description
Python Console Utilities
.. image:: https://travis-ci.com/Ruben9922/python-console-utilities.svg?branch=master :target: https://travis-ci.com/Ruben9922/python-console-utilities :alt: Build Status
.. image:: https://readthedocs.org/projects/python-console-utilities/badge/?version=latest :target: https://python-console-utilities.readthedocs.io/en/latest/?badge=latest :alt: Documentation Status
.. image:: https://img.shields.io/pypi/v/ruben-console-utilities :target: https://pypi.org/project/ruben-console-utilities/ :alt: PyPI
.. image:: https://img.shields.io/github/license/Ruben9922/python-console-utilities :target: https://github.com/Ruben9922/python-console-utilities/blob/master/LICENSE :alt: GitHub
This is a package containing utility functions for command-line applications.
.. Warning:: As this library is still in version 0.y.z, keep in mind that the API may change at any time. See Item 4 of the Semantic Versioning Specification: https://semver.org/#spec-item-4.
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 <https://docs.python.org/3/tutorial/venv.html#creating-virtual-environments>
_ 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
Hashes for ruben-console-utilities-0.2.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | c0fe84efa2bc8d40bbb52fee09d2807a2250dc1c18d770eedd3e43d73d9433a5 |
|
MD5 | a8aceedb8ece20af6abeda871020f046 |
|
BLAKE2b-256 | 3a59c20d0ae2ad5f0a1e399565077544f8d834079cd7518f2c9f6d6c4f53bf09 |
Hashes for ruben_console_utilities-0.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a72319013d3de8ed2ab6ceb3498d56115929ca71b0c45dd442697281c06f42fe |
|
MD5 | 3e71370d25115475ff7c5270adfae756 |
|
BLAKE2b-256 | 83fa9ebb4be46cece00e2176daaa476e17e2142ad44306c4f0b0cd0f591414f8 |