Skip to main content

Easily create robust Shell applications in Python with this extension for Click & Prompt-Toolkit; built with Windows OS in mind.

Project description

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:

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

pcshell-0.2.3.tar.gz (41.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pcshell-0.2.3-py3-none-any.whl (46.6 kB view details)

Uploaded Python 3

File details

Details for the file pcshell-0.2.3.tar.gz.

File metadata

  • Download URL: pcshell-0.2.3.tar.gz
  • Upload date:
  • Size: 41.1 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for pcshell-0.2.3.tar.gz
Algorithm Hash digest
SHA256 b10ba97f2cd9f6c837f5d29ea20477eab161472192f6d7bf2cdaeecc1beea301
MD5 d018dabb87b0f51aed38bf6beeec8225
BLAKE2b-256 81aad0691d94629c498e1724a2e1ef817d449598e46073ea77a4383b06d5f217

See more details on using hashes here.

File details

Details for the file pcshell-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: pcshell-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 46.6 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for pcshell-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b4de05464b847e7b18ad742e1bbee70dc5f954f284974537cf86af2a33e1450a
MD5 e45ae95f6ffff8405b41c7fdfce8d5a0
BLAKE2b-256 aee96981d39c76dfdcf7dbb1bc1d8e1888a185b596f8e4344def69d08d2c1f51

See more details on using hashes here.

Supported by

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