1- """Variant on standard library's cmd with extra features.
2-
3- To use, simply import cmd2.Cmd instead of cmd.Cmd; use precisely as though you
4- were using the standard library's cmd, while enjoying the extra features.
5-
6- Searchable command history (commands: "history")
7- Run commands from file, save to file, edit commands in file
8- Multi-line commands
9- Special-character shortcut commands (beyond cmd's "?" and "!")
10- Settable environment parameters
11- Parsing commands with `argparse` argument parsers (flags)
12- Redirection to file or paste buffer (clipboard) with > or >>
13- Easy transcript-based testing of applications (see examples/transcript_example.py)
14- Bash-style ``select`` available
1+ """cmd2 - quickly build feature-rich and user-friendly interactive command line applications in Python.
2+
3+ cmd2 is a tool for building interactive command line applications in Python. Its goal is to make it quick and easy for
4+ developers to build feature-rich and user-friendly interactive command line applications. It provides a simple API which
5+ is an extension of Python's built-in cmd module. cmd2 provides a wealth of features on top of cmd to make your life easier
6+ and eliminates much of the boilerplate code which would be necessary when using cmd.
7+
8+ Extra features include:
9+ - Searchable command history (commands: "history")
10+ - Run commands from file, save to file, edit commands in file
11+ - Multi-line commands
12+ - Special-character shortcut commands (beyond cmd's "?" and "!")
13+ - Settable environment parameters
14+ - Parsing commands with `argparse` argument parsers (flags)
15+ - Redirection to file or paste buffer (clipboard) with > or >>
16+ - Easy transcript-based testing of applications (see examples/transcript_example.py)
17+ - Bash-style ``select`` available
1518
1619Note, if self.stdout is different than sys.stdout, then redirection with > and |
1720will only work if `self.poutput()` is used in place of `print`.
1821
19- - Catherine Devlin, Jan 03 2008 - catherinedevlin.blogspot.com
20-
21- Git repository on GitHub at https://github.com/python-cmd2/cmd2
22+ GitHub: https://github.com/python-cmd2/cmd2
23+ Documentation: https://cmd2.readthedocs.io/
2224"""
2325
2426# This module has many imports, quite a few of which are only
6365)
6466
6567import rich .box
66- from rich .console import Group
68+ from rich .console import Group , RenderableType
6769from rich .highlighter import ReprHighlighter
6870from rich .rule import Rule
6971from rich .style import Style , StyleType
@@ -304,7 +306,6 @@ class Cmd:
304306 testfiles : ClassVar [list [str ]] = []
305307
306308 DEFAULT_PROMPT = '(Cmd) '
307- IDENTCHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_'
308309
309310 def __init__ (
310311 self ,
@@ -328,7 +329,7 @@ def __init__(
328329 auto_load_commands : bool = False ,
329330 allow_clipboard : bool = True ,
330331 suggest_similar_command : bool = False ,
331- intro : str = '' ,
332+ intro : RenderableType = '' ,
332333 ) -> None :
333334 """Easy but powerful framework for writing line-oriented command interpreters, extends Python's cmd package.
334335
@@ -393,7 +394,6 @@ def __init__(
393394
394395 # Configure a few defaults
395396 self .prompt = Cmd .DEFAULT_PROMPT
396- self .identchars = Cmd .IDENTCHARS
397397 self .intro = intro
398398 self .use_rawinput = True
399399
@@ -2715,10 +2715,6 @@ def postloop(self) -> None:
27152715 def parseline (self , line : str ) -> tuple [str , str , str ]:
27162716 """Parse the line into a command name and a string containing the arguments.
27172717
2718- NOTE: This is an override of a parent class method. It is only used by other parent class methods.
2719-
2720- Different from the parent class method, this ignores self.identchars.
2721-
27222718 :param line: line read by readline
27232719 :return: tuple containing (command, args, line)
27242720 """
0 commit comments