@@ -3508,9 +3508,9 @@ def _cmdloop(self) -> None:
3508
3508
# Top-level parser for alias
3509
3509
@staticmethod
3510
3510
def _build_alias_parser () -> Cmd2ArgumentParser :
3511
- alias_description = Group (
3511
+ alias_description = Text . assemble (
3512
3512
"Manage aliases." ,
3513
- "\n " ,
3513
+ "\n \n " ,
3514
3514
"An alias is a command that enables replacement of a word by another string." ,
3515
3515
)
3516
3516
alias_parser = argparse_custom .DEFAULT_ARGUMENT_PARSER (description = alias_description )
@@ -3537,10 +3537,11 @@ def _build_alias_create_parser(cls) -> Cmd2ArgumentParser:
3537
3537
alias_create_parser = argparse_custom .DEFAULT_ARGUMENT_PARSER (description = alias_create_description )
3538
3538
3539
3539
# Add Notes epilog
3540
- alias_create_notes = Group (
3540
+ alias_create_notes = Text . assemble (
3541
3541
"If you want to use redirection, pipes, or terminators in the value of the alias, then quote them." ,
3542
- "\n " ,
3543
- Text (" alias create save_results print_results \" >\" out.txt\n " , style = Cmd2Style .COMMAND_LINE ),
3542
+ "\n \n " ,
3543
+ (" alias create save_results print_results \" >\" out.txt\n " , Cmd2Style .COMMAND_LINE ),
3544
+ "\n \n " ,
3544
3545
(
3545
3546
"Since aliases are resolved during parsing, tab completion will function as it would "
3546
3547
"for the actual command the alias resolves to."
@@ -3639,12 +3640,12 @@ def _alias_delete(self, args: argparse.Namespace) -> None:
3639
3640
# alias -> list
3640
3641
@classmethod
3641
3642
def _build_alias_list_parser (cls ) -> Cmd2ArgumentParser :
3642
- alias_list_description = Group (
3643
+ alias_list_description = Text . assemble (
3643
3644
(
3644
3645
"List specified aliases in a reusable form that can be saved to a startup "
3645
3646
"script to preserve aliases across sessions."
3646
3647
),
3647
- "\n " ,
3648
+ "\n \n " ,
3648
3649
"Without arguments, all aliases will be listed." ,
3649
3650
)
3650
3651
@@ -3719,9 +3720,9 @@ def macro_arg_complete(
3719
3720
# Top-level parser for macro
3720
3721
@staticmethod
3721
3722
def _build_macro_parser () -> Cmd2ArgumentParser :
3722
- macro_description = Group (
3723
+ macro_description = Text . assemble (
3723
3724
"Manage macros." ,
3724
- "\n " ,
3725
+ "\n \n " ,
3725
3726
"A macro is similar to an alias, but it can contain argument placeholders." ,
3726
3727
)
3727
3728
macro_parser = argparse_custom .DEFAULT_ARGUMENT_PARSER (description = macro_description )
@@ -3744,48 +3745,46 @@ def do_macro(self, args: argparse.Namespace) -> None:
3744
3745
# macro -> create
3745
3746
@classmethod
3746
3747
def _build_macro_create_parser (cls ) -> Cmd2ArgumentParser :
3747
- macro_create_description = Group (
3748
+ macro_create_description = Text . assemble (
3748
3749
"Create or overwrite a macro." ,
3749
- "\n " ,
3750
+ "\n \n " ,
3750
3751
"A macro is similar to an alias, but it can contain argument placeholders." ,
3751
- "\n " ,
3752
+ "\n \n " ,
3752
3753
"Arguments are expressed when creating a macro using {#} notation where {1} means the first argument." ,
3753
- "\n " ,
3754
+ "\n \n " ,
3754
3755
"The following creates a macro called my_macro that expects two arguments:" ,
3755
- "\n " ,
3756
- Text (" macro create my_macro make_dinner --meat {1} --veggie {2}" , style = Cmd2Style .COMMAND_LINE ),
3757
- "\n " ,
3756
+ "\n \n " ,
3757
+ (" macro create my_macro make_dinner --meat {1} --veggie {2}" , Cmd2Style .COMMAND_LINE ),
3758
+ "\n \n " ,
3758
3759
"When the macro is called, the provided arguments are resolved and the assembled command is run. For example:" ,
3759
- "\n " ,
3760
- Text .assemble (
3761
- (" my_macro beef broccoli" , Cmd2Style .COMMAND_LINE ),
3762
- (" ───> " , Style (bold = True )),
3763
- ("make_dinner --meat beef --veggie broccoli" , Cmd2Style .COMMAND_LINE ),
3764
- ),
3760
+ "\n \n " ,
3761
+ (" my_macro beef broccoli" , Cmd2Style .COMMAND_LINE ),
3762
+ (" ───> " , Style (bold = True )),
3763
+ ("make_dinner --meat beef --veggie broccoli" , Cmd2Style .COMMAND_LINE ),
3765
3764
)
3766
3765
macro_create_parser = argparse_custom .DEFAULT_ARGUMENT_PARSER (description = macro_create_description )
3767
3766
3768
3767
# Add Notes epilog
3769
- macro_create_notes = Group (
3768
+ macro_create_notes = Text . assemble (
3770
3769
"To use the literal string {1} in your command, escape it this way: {{1}}." ,
3771
- "\n " ,
3770
+ "\n \n " ,
3772
3771
"Extra arguments passed to a macro are appended to resolved command." ,
3773
- "\n " ,
3772
+ "\n \n " ,
3774
3773
(
3775
3774
"An argument number can be repeated in a macro. In the following example the "
3776
3775
"first argument will populate both {1} instances."
3777
3776
),
3778
- "\n " ,
3779
- Text (" macro create ft file_taxes -p {1} -q {2} -r {1}" , style = Cmd2Style .COMMAND_LINE ),
3780
- "\n " ,
3777
+ "\n \n " ,
3778
+ (" macro create ft file_taxes -p {1} -q {2} -r {1}" , Cmd2Style .COMMAND_LINE ),
3779
+ "\n \n " ,
3781
3780
"To quote an argument in the resolved command, quote it during creation." ,
3782
- "\n " ,
3783
- Text (" macro create backup !cp \" {1}\" \" {1}.orig\" " , style = Cmd2Style .COMMAND_LINE ),
3784
- "\n " ,
3781
+ "\n \n " ,
3782
+ (" macro create backup !cp \" {1}\" \" {1}.orig\" " , Cmd2Style .COMMAND_LINE ),
3783
+ "\n \n " ,
3785
3784
"If you want to use redirection, pipes, or terminators in the value of the macro, then quote them." ,
3786
- "\n " ,
3787
- Text (" macro create show_results print_results -type {1} \" |\" less" , style = Cmd2Style .COMMAND_LINE ),
3788
- "\n " ,
3785
+ "\n \n " ,
3786
+ (" macro create show_results print_results -type {1} \" |\" less" , Cmd2Style .COMMAND_LINE ),
3787
+ "\n \n " ,
3789
3788
(
3790
3789
"Since macros don't resolve until after you press Enter, their arguments tab complete as paths. "
3791
3790
"This default behavior changes if custom tab completion for macro arguments has been implemented."
@@ -3926,11 +3925,10 @@ def _macro_delete(self, args: argparse.Namespace) -> None:
3926
3925
3927
3926
# macro -> list
3928
3927
macro_list_help = "list macros"
3929
- macro_list_description = (
3930
- "List specified macros in a reusable form that can be saved to a startup script\n "
3931
- "to preserve macros across sessions\n "
3932
- "\n "
3933
- "Without arguments, all macros will be listed."
3928
+ macro_list_description = Text .assemble (
3929
+ "List specified macros in a reusable form that can be saved to a startup script to preserve macros across sessions." ,
3930
+ "\n \n " ,
3931
+ "Without arguments, all macros will be listed." ,
3934
3932
)
3935
3933
3936
3934
macro_list_parser = argparse_custom .DEFAULT_ARGUMENT_PARSER (description = macro_list_description )
@@ -4385,9 +4383,9 @@ def select(self, opts: str | list[str] | list[tuple[Any, str | None]], prompt: s
4385
4383
def _build_base_set_parser (cls ) -> Cmd2ArgumentParser :
4386
4384
# When tab completing value, we recreate the set command parser with a value argument specific to
4387
4385
# the settable being edited. To make this easier, define a base parser with all the common elements.
4388
- set_description = Group (
4386
+ set_description = Text . assemble (
4389
4387
"Set a settable parameter or show current settings of parameters." ,
4390
- "\n " ,
4388
+ "\n \n " ,
4391
4389
(
4392
4390
"Call without arguments for a list of all settable parameters with their values. "
4393
4391
"Call with just param to view that parameter's value."
@@ -5380,9 +5378,9 @@ def _current_script_dir(self) -> str | None:
5380
5378
5381
5379
@classmethod
5382
5380
def _build_base_run_script_parser (cls ) -> Cmd2ArgumentParser :
5383
- run_script_description = Group (
5381
+ run_script_description = Text . assemble (
5384
5382
"Run text script." ,
5385
- "\n " ,
5383
+ "\n \n " ,
5386
5384
"Scripts should contain one command per line, entered as you would in the console." ,
5387
5385
)
5388
5386
0 commit comments