diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2019-08-02 01:38:18 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-02 01:38:18 -0400 |
commit | 65875bdfc434474ecd2c019ef77fa99d3da8faf9 (patch) | |
tree | d201acb74240e98353879d49d94ec4b907b5e2a0 | |
parent | bb66b9201b8a33fa176cc11b4c49956a96e678a8 (diff) | |
parent | b9226c4ccf6e8227b106f0b29d7bde02ad19ecc3 (diff) | |
download | cmd2-git-65875bdfc434474ecd2c019ef77fa99d3da8faf9.tar.gz |
Merge pull request #745 from python-cmd2/doc_update
Added terminators to cmd2.Cmd's docstring
-rw-r--r-- | cmd2/cmd2.py | 15 | ||||
-rw-r--r-- | cmd2/parsing.py | 4 |
2 files changed, 12 insertions, 7 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py index 7c529acc..76b56531 100644 --- a/cmd2/cmd2.py +++ b/cmd2/cmd2.py @@ -355,7 +355,12 @@ class Cmd(cmd.Cmd): :param transcript_files: allow running transcript tests when allow_cli_args is False :param allow_redirection: should output redirection and pipes be allowed :param multiline_commands: list of commands allowed to accept multi-line input - :param shortcuts: dictionary containing shortcuts for commands + :param terminators: list of characters that terminate a command. These are mainly intended for terminating + multiline commands, but will also terminate single-line commands. If not supplied, then + defaults to semicolon. If your app only contains single-line commands and you want + terminators to be treated as literals by the parser, then set this to an empty list. + :param shortcuts: dictionary containing shortcuts for commands. If not supplied, then defaults to + constants.DEFAULT_SHORTCUTS. """ # If use_ipython is False, make sure the do_ipy() method doesn't exit if not use_ipython: @@ -2451,8 +2456,8 @@ class Cmd(cmd.Cmd): alias_create_description = "Create or overwrite an alias" alias_create_epilog = ("Notes:\n" - " If you want to use redirection, pipes, or terminators like ';' in the value\n" - " of the alias, then quote them.\n" + " If you want to use redirection, pipes, or terminators in the value of the\n" + " alias, then quote them.\n" "\n" " Since aliases are resolved during parsing, tab completion will function as\n" " it would for the actual command the alias resolves to.\n" @@ -2657,8 +2662,8 @@ class Cmd(cmd.Cmd): "\n" " macro create backup !cp \"{1}\" \"{1}.orig\"\n" "\n" - " If you want to use redirection, pipes, or terminators like ';' in the value\n" - " of the macro, then quote them.\n" + " If you want to use redirection, pipes, or terminators in the value of the\n" + " macro, then quote them.\n" "\n" " macro create show_results print_results -type {1} \"|\" less\n" "\n" diff --git a/cmd2/parsing.py b/cmd2/parsing.py index dfa248e9..db085f5f 100644 --- a/cmd2/parsing.py +++ b/cmd2/parsing.py @@ -185,7 +185,7 @@ class Statement(str): """Combine command and args with a space separating them. Quoted arguments remain quoted. Output redirection and piping are - excluded, as are any multiline command terminators. + excluded, as are any command terminators. """ if self.command and self.args: rtn = '{} {}'.format(self.command, self.args) @@ -258,7 +258,7 @@ class StatementParser: * shortcuts :param allow_redirection: should redirection and pipes be allowed? - :param terminators: iterable containing strings which should terminate multiline commands + :param terminators: iterable containing strings which should terminate commands :param multiline_commands: iterable containing the names of commands that accept multiline input :param aliases: dictionary containing aliases :param shortcuts: dictionary containing shortcuts |