Skip to main content

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 (Windows, Linux, MacOS). Requires cmd2 version 0.9.12 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


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.2.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

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

cmd2_abbrev-1.0.2-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file cmd2-abbrev-1.0.2.tar.gz.

File metadata

  • Download URL: cmd2-abbrev-1.0.2.tar.gz
  • Upload date:
  • Size: 10.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.40.1 CPython/3.8.0

File hashes

Hashes for cmd2-abbrev-1.0.2.tar.gz
Algorithm Hash digest
SHA256 f5ebd3ad64da81c4d834ad4d2e688905f7fd3161b8a18cd593df827e5da44861
MD5 46e86c1a95f0dc3f1423cbba004398c6
BLAKE2b-256 c12e3e9c52d8bc643820b38cae0458c280d967e2c13cf1f1a62aeb83cb87456a

See more details on using hashes here.

File details

Details for the file cmd2_abbrev-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: cmd2_abbrev-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.40.1 CPython/3.8.0

File hashes

Hashes for cmd2_abbrev-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b4c0440b95befedf9a89191d169db93fcfd9e23db394808d6631b2d60e91b1c4
MD5 6bb68ededa6cba27481b2edbf9a893d7
BLAKE2b-256 5082fabf6f3395ba6bed2fa413b0c951b440c0af5d2a0a4e1d67332ec435b25c

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