Skip to main content

pretty-click-shell :pager:

Create shell applications using Click for Python, with several out-of-the-box bells and whistles for a snazzier look and simple customization

Features

Pcshellprovides several features that piggyback off of the Click Framework to make writing intuitive, versatile Shell applications as simple as writing a standard Click CLI. This includes:

  • Pretty Formatting of all Help & Error text
  • Full Autocompletion for Click Groups, Commands, and Sub-Shells.
  • Automatic Lexing of your CLI
  • Support for Typed Tuple Literals as Option Parameters
  • Bult-in Shell Commands: repeat, clear screen, clear history, etc.
  • Command/Group Aliases
  • Suggestions for mistyped commands
  • Full support for Windows OS
  • Full customization of colors

Pretty Click Shell Demo

Installing

Installing Pretty Click Shell is easy. Simply use PyPi to install the module. Please review the requirements before installing.

pip install pcshell

Warning: This package is currently in an Alpha state.

Windows Users: In order for Mouse Support to work for autocompletion prompts, you will need to patch Prompt_Toolkit. I have included the patch in this repository. You can patch the*.py files yourself or use the windows_patch.bat.

If you do not care about mouse support, be sure to set mouse_support=False when initializing your Shell.

Requirements

Pcshell is built for Windows OS. However, it should work with other systems as well, but it has never been tested.

Pcshell requires the following modules:

  • click==7.1.2
  • colorama

And, then either:

  • pyreadline

Or

  • prompt-toolkit==2.0.10
  • pygments

Pcshell uses Prompt Toolkit to provide Click autocompletion, lexing, and more- but it is not required. If you do not need want these features, then only pyreadline is required, and your Shell Application will function with these features simply absent.

Prompt Toolkit v.2.0.10 is specifically required at this time due to incompatibilities with the Windows Terminal in the latest version. This may change in the future. Click v.7.1.2 is specifically required at this time due to breaking changes in >v.8.x.x

At this time, the PyPi package for pcshell requires all of these listed modules as dependencies to make for easier testing of the package, as most of the core features rely on Prompt Toolkit. If you are a minimalist, you can go ahead and uninstall what you don't need or disable the features when initializing your shell.

Getting Started

Creating a new shell application is simple. You will only need to import pcshell and use this module in place of click, as appropriate.

To get started, take a look at these sample applications to get an understanding of all of the features pcshell has to offer:

Be sure to read the libraries docstrings, too, where appropriate for further details about keyword arguments, constants, and methods / decorators.

To-Do List:

These are additional features I would like to implement into pcshell in the future:

  • Prompt Toolkit "rprompt" for live analysis of command errors
  • Customizable Prompt Toolkit Toolbar for additional meta info/help text
  • Lexing for invalid typed tuple literal Option Parameters

Feedback?

I wrote Pretty Click Shell because I wanted a versatile template for writing shell applications with my favorite CLI framework, Click, specifically on Windows. This grew into me learning a lot more about Prompt Toolkit and how I could integrate these features automatically with my Click apps.

If you have any suggestions or bugs to report, please create an issue here for me to review. Help me grow this project so that other developers on Windows OS can make some cool shell applications with Click :smile:

Metadata

Release files for pcshell 0.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pcshell 0.2.3
File Size Uploaded
pcshell-0.2.3.tar.gz 41.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pcshell 0.2.3
File Interpreter ABI Platform
pcshell-0.2.3-py3-none-any.whl Python 3 none any Details

Total release size: 87.8 kB

Release files / pcshell-0.2.3.tar.gz

Download URL pcshell-0.2.3.tar.gz
Size 41.1 kB
Tags Source
SHA-256 checksum
How to use checksums
b10ba97f2cd9f6c837f5d29ea20477eab161472192f6d7bf2cdaeecc1beea301
BLAKE2b-256 checksum
How to use checksums
81aad0691d94629c498e1724a2e1ef817d449598e46073ea77a4383b06d5f217
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.1

Release files / pcshell-0.2.3-py3-none-any.whl

Download URL pcshell-0.2.3-py3-none-any.whl
Size 46.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b4de05464b847e7b18ad742e1bbee70dc5f954f284974537cf86af2a33e1450a
BLAKE2b-256 checksum
How to use checksums
aee96981d39c76dfdcf7dbb1bc1d8e1888a185b596f8e4344def69d08d2c1f51
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.1

Release history Release notifications | RSS feed

This release

0.2.3 This release

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page