Skip to main content

Simple utility functions for command-line applications.

Project description

Build Status Documentation Status PyPI GitHub

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

ruben-console-utilities-0.3.0.tar.gz (8.2 kB view hashes)

Uploaded Source

Built Distribution

ruben_console_utilities-0.3.0-py3-none-any.whl (8.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page