Plugin to add command abbreviation support to cmd2
Project description
cmd2-abbrev
Description
Plugin for cmd2 to support previously deprecated abbreviation behavior.
Adds a setting abbrev
which allows users to control whether commands
can be abbreviated. If an application has a speak
command:
(Cmd) speak hello
hello
then any unique prefix of any command will run the command:
(Cmd) set abbrev True
abbrev - was: False
now: True
(Cmd) sp hello
hello
Non-unique abbreviations generate a syntax error:
(Cmd) s hello
*** Unknown syntax: s hello
(Cmd) help
Documented commands (type help <topic>):
========================================
alias help load pyscript set shortcuts unalias
edit history py quit shell speak
Installation
System requirements: works anywhere cmd2
works. Requires cmd2
version 0.9.4
or higher.
Install using pip:
$ pip install cmd2-abbrev
Add to your cmd2
application by mixing in the AbbrevMixin
class:
import cmd2
import cmd2_abbrev
class AbbrevExample(cmd2_abbrev.AbbrevMixin, cmd2.Cmd):
"""A cmd2 program to demonstrate the use of the cmd2_abbrev plugin"""
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
You must mix in AbbrevMixin
before cmd2.Cmd
or it won't work properly.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
cmd2-abbrev-1.0.1.tar.gz
(9.6 kB
view hashes)
Built Distribution
Close
Hashes for cmd2_abbrev-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 552f26b2a62d39eaaebb6ca64b6eff1f31a90b5203d21e771ecb7c5872d7872c |
|
MD5 | 35f63d9124aa046e58e7325e10551a57 |
|
BLAKE2b-256 | 1563fb27fb08d86a82b4cd83de65d3abf95a81ff700185ef4cbe29e9a9dae305 |