Skip to content

Commit 65875bd

Browse files
authored
Merge pull request #745 from python-cmd2/doc_update
Added terminators to cmd2.Cmd's docstring
2 parents bb66b92 + b9226c4 commit 65875bd

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

cmd2/cmd2.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,12 @@ def __init__(self, completekey: str = 'tab', stdin=None, stdout=None, *,
355355
:param transcript_files: allow running transcript tests when allow_cli_args is False
356356
:param allow_redirection: should output redirection and pipes be allowed
357357
:param multiline_commands: list of commands allowed to accept multi-line input
358-
:param shortcuts: dictionary containing shortcuts for commands
358+
:param terminators: list of characters that terminate a command. These are mainly intended for terminating
359+
multiline commands, but will also terminate single-line commands. If not supplied, then
360+
defaults to semicolon. If your app only contains single-line commands and you want
361+
terminators to be treated as literals by the parser, then set this to an empty list.
362+
:param shortcuts: dictionary containing shortcuts for commands. If not supplied, then defaults to
363+
constants.DEFAULT_SHORTCUTS.
359364
"""
360365
# If use_ipython is False, make sure the do_ipy() method doesn't exit
361366
if not use_ipython:
@@ -2451,8 +2456,8 @@ def _alias_list(self, args: argparse.Namespace) -> None:
24512456
alias_create_description = "Create or overwrite an alias"
24522457

24532458
alias_create_epilog = ("Notes:\n"
2454-
" If you want to use redirection, pipes, or terminators like ';' in the value\n"
2455-
" of the alias, then quote them.\n"
2459+
" If you want to use redirection, pipes, or terminators in the value of the\n"
2460+
" alias, then quote them.\n"
24562461
"\n"
24572462
" Since aliases are resolved during parsing, tab completion will function as\n"
24582463
" it would for the actual command the alias resolves to.\n"
@@ -2657,8 +2662,8 @@ def _macro_list(self, args: argparse.Namespace) -> None:
26572662
"\n"
26582663
" macro create backup !cp \"{1}\" \"{1}.orig\"\n"
26592664
"\n"
2660-
" If you want to use redirection, pipes, or terminators like ';' in the value\n"
2661-
" of the macro, then quote them.\n"
2665+
" If you want to use redirection, pipes, or terminators in the value of the\n"
2666+
" macro, then quote them.\n"
26622667
"\n"
26632668
" macro create show_results print_results -type {1} \"|\" less\n"
26642669
"\n"

cmd2/parsing.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ def command_and_args(self) -> str:
185185
"""Combine command and args with a space separating them.
186186
187187
Quoted arguments remain quoted. Output redirection and piping are
188-
excluded, as are any multiline command terminators.
188+
excluded, as are any command terminators.
189189
"""
190190
if self.command and self.args:
191191
rtn = '{} {}'.format(self.command, self.args)
@@ -258,7 +258,7 @@ def __init__(self,
258258
* shortcuts
259259
260260
:param allow_redirection: should redirection and pipes be allowed?
261-
:param terminators: iterable containing strings which should terminate multiline commands
261+
:param terminators: iterable containing strings which should terminate commands
262262
:param multiline_commands: iterable containing the names of commands that accept multiline input
263263
:param aliases: dictionary containing aliases
264264
:param shortcuts: dictionary containing shortcuts

0 commit comments

Comments
 (0)