@@ -474,7 +474,6 @@ def __init__(
474474 self .debug = False
475475 self .echo = False
476476 self .editor = self .DEFAULT_EDITOR
477- self .feedback_to_output = False # Do not include nonessentials in >, | output by default (things like timing)
478477 self .quiet = False # Do not suppress nonessential output
479478 self .scripts_add_to_history = True # Scripts and pyscripts add commands to history
480479 self .timing = False # Prints elapsed time for each command
@@ -1370,7 +1369,6 @@ def allow_style_type(value: str) -> ru.AllowStyle:
13701369 self .add_settable (Settable ("debug" , bool , "Show full traceback on exception" , self ))
13711370 self .add_settable (Settable ("echo" , bool , "Echo command issued into output" , self ))
13721371 self .add_settable (Settable ("editor" , str , "Program used by 'edit'" , self ))
1373- self .add_settable (Settable ("feedback_to_output" , bool , "Include nonessentials in '|' and '>' results" , self ))
13741372 self .add_settable (
13751373 Settable (
13761374 "max_completion_table_items" ,
@@ -1754,40 +1752,23 @@ def pfeedback(
17541752 rich_print_kwargs : Mapping [str , Any ] | None = None ,
17551753 ** kwargs : Any , # noqa: ARG002
17561754 ) -> None :
1757- """Print nonessential feedback.
1758-
1759- The output can be silenced with the `quiet` setting and its inclusion in redirected output
1760- is controlled by the `feedback_to_output` setting.
1755+ """Print nonessential feedback where the output can be silenced with the `quiet` setting.
17611756
17621757 For details on the parameters, refer to the `print_to` method documentation.
17631758 """
17641759 if not self .quiet :
1765- if self .feedback_to_output :
1766- self .poutput (
1767- * objects ,
1768- sep = sep ,
1769- end = end ,
1770- style = style ,
1771- soft_wrap = soft_wrap ,
1772- justify = justify ,
1773- emoji = emoji ,
1774- markup = markup ,
1775- highlight = highlight ,
1776- rich_print_kwargs = rich_print_kwargs ,
1777- )
1778- else :
1779- self .perror (
1780- * objects ,
1781- sep = sep ,
1782- end = end ,
1783- style = style ,
1784- soft_wrap = soft_wrap ,
1785- justify = justify ,
1786- emoji = emoji ,
1787- markup = markup ,
1788- highlight = highlight ,
1789- rich_print_kwargs = rich_print_kwargs ,
1790- )
1760+ self .poutput (
1761+ * objects ,
1762+ sep = sep ,
1763+ end = end ,
1764+ style = style ,
1765+ soft_wrap = soft_wrap ,
1766+ justify = justify ,
1767+ emoji = emoji ,
1768+ markup = markup ,
1769+ highlight = highlight ,
1770+ rich_print_kwargs = rich_print_kwargs ,
1771+ )
17911772
17921773 def ppaged (
17931774 self ,
@@ -2992,7 +2973,7 @@ def onecmd_plus_hooks(
29922973 stop = self .postcmd (stop , statement )
29932974
29942975 if self .timing :
2995- self .pfeedback (f"Elapsed: { datetime .datetime .now (tz = datetime .timezone .utc ) - timestart } " )
2976+ self .perror (f"Elapsed: { datetime .datetime .now (tz = datetime .timezone .utc ) - timestart } " , style = None )
29962977 finally :
29972978 # Get sigint protection while we restore stuff
29982979 with self .sigint_protection :
@@ -3862,7 +3843,7 @@ def _alias_create(self, args: argparse.Namespace) -> None:
38623843
38633844 # Set the alias
38643845 result = "overwritten" if args .name in self .aliases else "created"
3865- self .poutput (f"Alias '{ args .name } ' { result } " )
3846+ self .pfeedback (f"Alias '{ args .name } ' { result } " )
38663847
38673848 self .aliases [args .name ] = value
38683849 self .last_result = True
@@ -3891,15 +3872,15 @@ def _alias_delete(self, args: argparse.Namespace) -> None:
38913872
38923873 if args .all :
38933874 self .aliases .clear ()
3894- self .poutput ("All aliases deleted" )
3875+ self .pfeedback ("All aliases deleted" )
38953876 elif not args .names :
38963877 self .perror ("Either --all or alias name(s) must be specified" )
38973878 self .last_result = False
38983879 else :
38993880 for cur_name in utils .remove_duplicates (args .names ):
39003881 if cur_name in self .aliases :
39013882 del self .aliases [cur_name ]
3902- self .poutput (f"Alias '{ cur_name } ' deleted" )
3883+ self .pfeedback (f"Alias '{ cur_name } ' deleted" )
39033884 else :
39043885 self .perror (f"Alias '{ cur_name } ' does not exist" )
39053886
@@ -4028,7 +4009,7 @@ def _build_macro_create_parser(cls) -> Cmd2ArgumentParser:
40284009 "When the macro is called, the provided arguments are resolved and the assembled command is run. For example:" ,
40294010 "\n \n " ,
40304011 (" my_macro beef broccoli" , Cmd2Style .COMMAND_LINE ),
4031- (" ─── > " , Style (bold = True )),
4012+ (" ─> " , Style (bold = True )),
40324013 ("make_dinner --meat beef --veggie broccoli" , Cmd2Style .COMMAND_LINE ),
40334014 )
40344015 macro_create_parser = argparse_utils .DEFAULT_ARGUMENT_PARSER (description = macro_create_description )
@@ -4150,7 +4131,7 @@ def _macro_create(self, args: argparse.Namespace) -> None:
41504131
41514132 # Set the macro
41524133 result = "overwritten" if args .name in self .macros else "created"
4153- self .poutput (f"Macro '{ args .name } ' { result } " )
4134+ self .pfeedback (f"Macro '{ args .name } ' { result } " )
41544135
41554136 self .macros [args .name ] = Macro (name = args .name , value = value , minimum_arg_count = max_arg_num , args = macro_args )
41564137 self .last_result = True
@@ -4179,15 +4160,15 @@ def _macro_delete(self, args: argparse.Namespace) -> None:
41794160
41804161 if args .all :
41814162 self .macros .clear ()
4182- self .poutput ("All macros deleted" )
4163+ self .pfeedback ("All macros deleted" )
41834164 elif not args .names :
41844165 self .perror ("Either --all or macro name(s) must be specified" )
41854166 self .last_result = False
41864167 else :
41874168 for cur_name in utils .remove_duplicates (args .names ):
41884169 if cur_name in self .macros :
41894170 del self .macros [cur_name ]
4190- self .poutput (f"Macro '{ cur_name } ' deleted" )
4171+ self .pfeedback (f"Macro '{ cur_name } ' deleted" )
41914172 else :
41924173 self .perror (f"Macro '{ cur_name } ' does not exist" )
41934174
@@ -4737,12 +4718,17 @@ def do_set(self, args: argparse.Namespace) -> None:
47374718 if args .value :
47384719 # Try to update the settable's value
47394720 try :
4740- orig_value = settable .value
47414721 settable .value = su .strip_quotes (args .value )
47424722 except ValueError as ex :
47434723 self .perror (f"Error setting { args .param } : { ex } " )
47444724 else :
4745- self .poutput (f"{ args .param } - was: { orig_value !r} \n now: { settable .value !r} " )
4725+ # Create the feedback message using Rich Text for color
4726+ feedback_msg = Text .assemble (
4727+ f"{ args .param } ─> " ,
4728+ (f"{ settable .value !r} " , Cmd2Style .SUCCESS ),
4729+ )
4730+ self .pfeedback (feedback_msg )
4731+
47464732 self .last_result = True
47474733 return
47484734
0 commit comments