Skip to content

Commit

Permalink
Updated macro documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
kmvanbrunt committed Feb 22, 2019
1 parent bb37645 commit 163dcad
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Main Features
- Multi-line commands
- Special-character command shortcuts (beyond cmd's `?` and `!`)
- Command aliasing similar to bash `alias` command
- Macros, which are similar to aliases, but can take arguments when called
- Macros, which are similar to aliases, but they can contain argument placeholders
- Ability to load commands at startup from an initialization script
- Settable environment parameters
- Parsing commands with arguments using `argparse`, including support for sub-commands
Expand Down
4 changes: 2 additions & 2 deletions cmd2/cmd2.py
Original file line number Diff line number Diff line change
Expand Up @@ -2431,7 +2431,7 @@ def macro_list(self, args: argparse.Namespace) -> None:
# Top-level parser for macro
macro_description = ("Manage macros\n"
"\n"
"A macro is similar to an alias, but it can take arguments when called.")
"A macro is similar to an alias, but it can contain argument placeholders.")
macro_epilog = ("See also:\n"
" alias")
macro_parser = ACArgumentParser(description=macro_description, epilog=macro_epilog, prog='macro')
Expand All @@ -2443,7 +2443,7 @@ def macro_list(self, args: argparse.Namespace) -> None:
macro_create_help = "create or overwrite a macro"
macro_create_description = "Create or overwrite a macro"

macro_create_epilog = ("A macro is similar to an alias, but it can take arguments when called.\n"
macro_create_epilog = ("A macro is similar to an alias, but it can contain argument placeholders.\n"
"Arguments are expressed when creating a macro using {#} notation where {1}\n"
"means the first argument.\n"
"\n"
Expand Down
6 changes: 2 additions & 4 deletions docs/settingchanges.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,8 @@ Macros
======

``cmd2`` provides a feature that is similar to aliases called macros. The major difference between macros and aliases
is that macros are intended to take arguments when called. These can be useful if you need to run a complex command
frequently with different arguments that appear in various parts of the command.

Arguments are expressed when creating a macro using {#} notation where {1} means the first argument.
is that macros can contain argument placeholders. Arguments are expressed when creating a macro using {#} notation
where {1} means the first argument.

The following creates a macro called my_macro that expects two arguments:

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
- Multi-line commands
- Special-character command shortcuts (beyond cmd's `?` and `!`)
- Command aliasing similar to bash `alias` command
- Macros, which are similar to aliases, but can take arguments when called
- Macros, which are similar to aliases, but they can contain argument placeholders
- Ability to load commands at startup from an initialization script
- Settable environment parameters
- Parsing commands with arguments using `argparse`, including support for sub-commands
Expand Down

0 comments on commit 163dcad

Please sign in to comment.