Skip to content

Commit 163dcad

Browse files
committed
Updated macro documentation
1 parent bb37645 commit 163dcad

File tree

4 files changed

+6
-8
lines changed

4 files changed

+6
-8
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Main Features
3131
- Multi-line commands
3232
- Special-character command shortcuts (beyond cmd's `?` and `!`)
3333
- Command aliasing similar to bash `alias` command
34-
- Macros, which are similar to aliases, but can take arguments when called
34+
- Macros, which are similar to aliases, but they can contain argument placeholders
3535
- Ability to load commands at startup from an initialization script
3636
- Settable environment parameters
3737
- Parsing commands with arguments using `argparse`, including support for sub-commands

cmd2/cmd2.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2431,7 +2431,7 @@ def macro_list(self, args: argparse.Namespace) -> None:
24312431
# Top-level parser for macro
24322432
macro_description = ("Manage macros\n"
24332433
"\n"
2434-
"A macro is similar to an alias, but it can take arguments when called.")
2434+
"A macro is similar to an alias, but it can contain argument placeholders.")
24352435
macro_epilog = ("See also:\n"
24362436
" alias")
24372437
macro_parser = ACArgumentParser(description=macro_description, epilog=macro_epilog, prog='macro')
@@ -2443,7 +2443,7 @@ def macro_list(self, args: argparse.Namespace) -> None:
24432443
macro_create_help = "create or overwrite a macro"
24442444
macro_create_description = "Create or overwrite a macro"
24452445

2446-
macro_create_epilog = ("A macro is similar to an alias, but it can take arguments when called.\n"
2446+
macro_create_epilog = ("A macro is similar to an alias, but it can contain argument placeholders.\n"
24472447
"Arguments are expressed when creating a macro using {#} notation where {1}\n"
24482448
"means the first argument.\n"
24492449
"\n"

docs/settingchanges.rst

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,8 @@ Macros
7575
======
7676

7777
``cmd2`` provides a feature that is similar to aliases called macros. The major difference between macros and aliases
78-
is that macros are intended to take arguments when called. These can be useful if you need to run a complex command
79-
frequently with different arguments that appear in various parts of the command.
80-
81-
Arguments are expressed when creating a macro using {#} notation where {1} means the first argument.
78+
is that macros can contain argument placeholders. Arguments are expressed when creating a macro using {#} notation
79+
where {1} means the first argument.
8280

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

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
- Multi-line commands
2929
- Special-character command shortcuts (beyond cmd's `?` and `!`)
3030
- Command aliasing similar to bash `alias` command
31-
- Macros, which are similar to aliases, but can take arguments when called
31+
- Macros, which are similar to aliases, but they can contain argument placeholders
3232
- Ability to load commands at startup from an initialization script
3333
- Settable environment parameters
3434
- Parsing commands with arguments using `argparse`, including support for sub-commands

0 commit comments

Comments
 (0)