101101
102102from . import (
103103 argparse_completer ,
104- argparse_custom ,
104+ argparse_utils ,
105105 constants ,
106106 plugin ,
107107 utils ,
108108)
109109from . import rich_utils as ru
110110from . import string_utils as su
111- from .argparse_custom import (
111+ from .argparse_utils import (
112112 Cmd2ArgumentParser ,
113113 TextGroup ,
114114)
@@ -588,7 +588,7 @@ def __init__(
588588
589589 # Check for command line args
590590 if allow_cli_args :
591- parser = argparse_custom .DEFAULT_ARGUMENT_PARSER ()
591+ parser = argparse_utils .DEFAULT_ARGUMENT_PARSER ()
592592 _callopts , callargs = parser .parse_known_args ()
593593
594594 # If commands were supplied at invocation, then add them to the command queue
@@ -2587,7 +2587,7 @@ def complete(
25872587 break
25882588 else :
25892589 # No shortcut was found. Complete the command token.
2590- parser = argparse_custom .DEFAULT_ARGUMENT_PARSER (add_help = False )
2590+ parser = argparse_utils .DEFAULT_ARGUMENT_PARSER (add_help = False )
25912591 parser .add_argument (
25922592 'command' ,
25932593 metavar = "COMMAND" ,
@@ -3498,7 +3498,7 @@ def _resolve_completer(
34983498 raise ValueError (err_msg )
34993499
35003500 if parser is None :
3501- parser = argparse_custom .DEFAULT_ARGUMENT_PARSER (add_help = False )
3501+ parser = argparse_utils .DEFAULT_ARGUMENT_PARSER (add_help = False )
35023502 parser .add_argument (
35033503 'arg' ,
35043504 suppress_tab_hint = True ,
@@ -3727,7 +3727,7 @@ def _build_alias_parser() -> Cmd2ArgumentParser:
37273727 "\n \n " ,
37283728 "An alias is a command that enables replacement of a word by another string." ,
37293729 )
3730- alias_parser = argparse_custom .DEFAULT_ARGUMENT_PARSER (description = alias_description )
3730+ alias_parser = argparse_utils .DEFAULT_ARGUMENT_PARSER (description = alias_description )
37313731 alias_parser .epilog = TextGroup (
37323732 "See Also" ,
37333733 "macro" ,
@@ -3747,7 +3747,7 @@ def do_alias(self, args: argparse.Namespace) -> None:
37473747 @classmethod
37483748 def _build_alias_create_parser (cls ) -> Cmd2ArgumentParser :
37493749 alias_create_description = "Create or overwrite an alias."
3750- alias_create_parser = argparse_custom .DEFAULT_ARGUMENT_PARSER (description = alias_create_description )
3750+ alias_create_parser = argparse_utils .DEFAULT_ARGUMENT_PARSER (description = alias_create_description )
37513751
37523752 # Add Notes epilog
37533753 alias_create_notes = Text .assemble (
@@ -3819,7 +3819,7 @@ def _alias_create(self, args: argparse.Namespace) -> None:
38193819 def _build_alias_delete_parser (cls ) -> Cmd2ArgumentParser :
38203820 alias_delete_description = "Delete specified aliases or all aliases if --all is used."
38213821
3822- alias_delete_parser = argparse_custom .DEFAULT_ARGUMENT_PARSER (description = alias_delete_description )
3822+ alias_delete_parser = argparse_utils .DEFAULT_ARGUMENT_PARSER (description = alias_delete_description )
38233823 alias_delete_parser .add_argument ('-a' , '--all' , action = 'store_true' , help = "delete all aliases" )
38243824 alias_delete_parser .add_argument (
38253825 'names' ,
@@ -3862,7 +3862,7 @@ def _build_alias_list_parser(cls) -> Cmd2ArgumentParser:
38623862 "Without arguments, all aliases will be listed." ,
38633863 )
38643864
3865- alias_list_parser = argparse_custom .DEFAULT_ARGUMENT_PARSER (description = alias_list_description )
3865+ alias_list_parser = argparse_utils .DEFAULT_ARGUMENT_PARSER (description = alias_list_description )
38663866 alias_list_parser .add_argument (
38673867 'names' ,
38683868 nargs = argparse .ZERO_OR_MORE ,
@@ -3943,7 +3943,7 @@ def _build_macro_parser() -> Cmd2ArgumentParser:
39433943 "\n \n " ,
39443944 "A macro is similar to an alias, but it can contain argument placeholders." ,
39453945 )
3946- macro_parser = argparse_custom .DEFAULT_ARGUMENT_PARSER (description = macro_description )
3946+ macro_parser = argparse_utils .DEFAULT_ARGUMENT_PARSER (description = macro_description )
39473947 macro_parser .epilog = TextGroup (
39483948 "See Also" ,
39493949 "alias" ,
@@ -3979,7 +3979,7 @@ def _build_macro_create_parser(cls) -> Cmd2ArgumentParser:
39793979 (" ───> " , Style (bold = True )),
39803980 ("make_dinner --meat beef --veggie broccoli" , Cmd2Style .COMMAND_LINE ),
39813981 )
3982- macro_create_parser = argparse_custom .DEFAULT_ARGUMENT_PARSER (description = macro_create_description )
3982+ macro_create_parser = argparse_utils .DEFAULT_ARGUMENT_PARSER (description = macro_create_description )
39833983
39843984 # Add Notes epilog
39853985 macro_create_notes = Text .assemble (
@@ -4109,7 +4109,7 @@ def _macro_create(self, args: argparse.Namespace) -> None:
41094109 def _build_macro_delete_parser (cls ) -> Cmd2ArgumentParser :
41104110 macro_delete_description = "Delete specified macros or all macros if --all is used."
41114111
4112- macro_delete_parser = argparse_custom .DEFAULT_ARGUMENT_PARSER (description = macro_delete_description )
4112+ macro_delete_parser = argparse_utils .DEFAULT_ARGUMENT_PARSER (description = macro_delete_description )
41134113 macro_delete_parser .add_argument ('-a' , '--all' , action = 'store_true' , help = "delete all macros" )
41144114 macro_delete_parser .add_argument (
41154115 'names' ,
@@ -4152,7 +4152,7 @@ def _build_macro_list_parser(cls) -> Cmd2ArgumentParser:
41524152 "Without arguments, all macros will be listed." ,
41534153 )
41544154
4155- macro_list_parser = argparse_custom .DEFAULT_ARGUMENT_PARSER (description = macro_list_description )
4155+ macro_list_parser = argparse_utils .DEFAULT_ARGUMENT_PARSER (description = macro_list_description )
41564156 macro_list_parser .add_argument (
41574157 'names' ,
41584158 nargs = argparse .ZERO_OR_MORE ,
@@ -4254,7 +4254,7 @@ def _build_command_info(self) -> tuple[dict[str, list[str]], list[str]]:
42544254
42554255 @classmethod
42564256 def _build_help_parser (cls ) -> Cmd2ArgumentParser :
4257- help_parser = argparse_custom .DEFAULT_ARGUMENT_PARSER (
4257+ help_parser = argparse_utils .DEFAULT_ARGUMENT_PARSER (
42584258 description = "List available commands or provide detailed help for a specific command."
42594259 )
42604260 help_parser .add_argument (
@@ -4500,7 +4500,7 @@ def columnize(self, str_list: Sequence[str] | None, display_width: int = 80) ->
45004500
45014501 @staticmethod
45024502 def _build_shortcuts_parser () -> Cmd2ArgumentParser :
4503- return argparse_custom .DEFAULT_ARGUMENT_PARSER (description = "List available shortcuts." )
4503+ return argparse_utils .DEFAULT_ARGUMENT_PARSER (description = "List available shortcuts." )
45044504
45054505 @with_argparser (_build_shortcuts_parser )
45064506 def do_shortcuts (self , _ : argparse .Namespace ) -> None :
@@ -4513,7 +4513,7 @@ def do_shortcuts(self, _: argparse.Namespace) -> None:
45134513
45144514 @staticmethod
45154515 def _build__eof_parser () -> Cmd2ArgumentParser :
4516- _eof_parser = argparse_custom .DEFAULT_ARGUMENT_PARSER (description = "Called when Ctrl-D is pressed." )
4516+ _eof_parser = argparse_utils .DEFAULT_ARGUMENT_PARSER (description = "Called when Ctrl-D is pressed." )
45174517 _eof_parser .epilog = TextGroup (
45184518 "Note" ,
45194519 "This command is for internal use and is not intended to be called from the command line." ,
@@ -4534,7 +4534,7 @@ def do__eof(self, _: argparse.Namespace) -> bool | None:
45344534
45354535 @staticmethod
45364536 def _build_quit_parser () -> Cmd2ArgumentParser :
4537- return argparse_custom .DEFAULT_ARGUMENT_PARSER (description = "Exit this application." )
4537+ return argparse_utils .DEFAULT_ARGUMENT_PARSER (description = "Exit this application." )
45384538
45394539 @with_argparser (_build_quit_parser )
45404540 def do_quit (self , _ : argparse .Namespace ) -> bool | None :
@@ -4621,7 +4621,7 @@ def _build_base_set_parser(cls) -> Cmd2ArgumentParser:
46214621 "Call with just param to view that parameter's value."
46224622 ),
46234623 )
4624- base_set_parser = argparse_custom .DEFAULT_ARGUMENT_PARSER (description = set_description )
4624+ base_set_parser = argparse_utils .DEFAULT_ARGUMENT_PARSER (description = set_description )
46254625 base_set_parser .add_argument (
46264626 'param' ,
46274627 nargs = argparse .OPTIONAL ,
@@ -4736,7 +4736,7 @@ def do_set(self, args: argparse.Namespace) -> None:
47364736
47374737 @classmethod
47384738 def _build_shell_parser (cls ) -> Cmd2ArgumentParser :
4739- shell_parser = argparse_custom .DEFAULT_ARGUMENT_PARSER (description = "Execute a command as if at the OS prompt." )
4739+ shell_parser = argparse_utils .DEFAULT_ARGUMENT_PARSER (description = "Execute a command as if at the OS prompt." )
47404740 shell_parser .add_argument ('command' , help = 'the command to run' , completer = cls .shell_cmd_complete )
47414741 shell_parser .add_argument (
47424742 'command_args' , nargs = argparse .REMAINDER , help = 'arguments to pass to command' , completer = cls .path_complete
@@ -4984,7 +4984,7 @@ def py_quit() -> None:
49844984
49854985 @staticmethod
49864986 def _build_py_parser () -> Cmd2ArgumentParser :
4987- return argparse_custom .DEFAULT_ARGUMENT_PARSER (description = "Run an interactive Python shell." )
4987+ return argparse_utils .DEFAULT_ARGUMENT_PARSER (description = "Run an interactive Python shell." )
49884988
49894989 @with_argparser (_build_py_parser )
49904990 def do_py (self , _ : argparse .Namespace ) -> bool | None :
@@ -4997,7 +4997,7 @@ def do_py(self, _: argparse.Namespace) -> bool | None:
49974997
49984998 @classmethod
49994999 def _build_run_pyscript_parser (cls ) -> Cmd2ArgumentParser :
5000- run_pyscript_parser = argparse_custom .DEFAULT_ARGUMENT_PARSER (
5000+ run_pyscript_parser = argparse_utils .DEFAULT_ARGUMENT_PARSER (
50015001 description = "Run Python script within this application's environment."
50025002 )
50035003 run_pyscript_parser .add_argument ('script_path' , help = 'path to the script file' , completer = cls .path_complete )
@@ -5043,7 +5043,7 @@ def do_run_pyscript(self, args: argparse.Namespace) -> bool | None:
50435043
50445044 @staticmethod
50455045 def _build_ipython_parser () -> Cmd2ArgumentParser :
5046- return argparse_custom .DEFAULT_ARGUMENT_PARSER (description = "Run an interactive IPython shell." )
5046+ return argparse_utils .DEFAULT_ARGUMENT_PARSER (description = "Run an interactive IPython shell." )
50475047
50485048 @with_argparser (_build_ipython_parser )
50495049 def do_ipy (self , _ : argparse .Namespace ) -> bool | None : # pragma: no cover
@@ -5121,8 +5121,8 @@ def do_ipy(self, _: argparse.Namespace) -> bool | None: # pragma: no cover
51215121 def _build_history_parser (cls ) -> Cmd2ArgumentParser :
51225122 history_description = "View, run, edit, save, or clear previously entered commands."
51235123
5124- history_parser = argparse_custom .DEFAULT_ARGUMENT_PARSER (
5125- description = history_description , formatter_class = argparse_custom .RawTextCmd2HelpFormatter
5124+ history_parser = argparse_utils .DEFAULT_ARGUMENT_PARSER (
5125+ description = history_description , formatter_class = argparse_utils .RawTextCmd2HelpFormatter
51265126 )
51275127 history_action_group = history_parser .add_mutually_exclusive_group ()
51285128 history_action_group .add_argument ('-r' , '--run' , action = 'store_true' , help = 'run selected history items' )
@@ -5390,7 +5390,7 @@ def _persist_history(self) -> None:
53905390 @classmethod
53915391 def _build_edit_parser (cls ) -> Cmd2ArgumentParser :
53925392 edit_description = "Run a text editor and optionally open a file with it."
5393- edit_parser = argparse_custom .DEFAULT_ARGUMENT_PARSER (description = edit_description )
5393+ edit_parser = argparse_utils .DEFAULT_ARGUMENT_PARSER (description = edit_description )
53945394 edit_parser .epilog = TextGroup (
53955395 "Note" ,
53965396 Text .assemble (
@@ -5443,7 +5443,7 @@ def _build_base_run_script_parser(cls) -> Cmd2ArgumentParser:
54435443 "Scripts should contain one command per line, entered as you would in the console." ,
54445444 )
54455445
5446- run_script_parser = argparse_custom .DEFAULT_ARGUMENT_PARSER (description = run_script_description )
5446+ run_script_parser = argparse_utils .DEFAULT_ARGUMENT_PARSER (description = run_script_description )
54475447 run_script_parser .add_argument (
54485448 'script_path' ,
54495449 help = "path to the script file" ,
0 commit comments