@@ -1198,22 +1198,39 @@ def print_to(
11981198 end : str = "\n " ,
11991199 style : StyleType | None = None ,
12001200 soft_wrap : bool = True ,
1201+ emoji : bool = False ,
1202+ markup : bool = False ,
1203+ highlight : bool = False ,
12011204 rich_print_kwargs : RichPrintKwargs | None = None ,
12021205 ** kwargs : Any , # noqa: ARG002
12031206 ) -> None :
12041207 """Print objects to a given file stream.
12051208
1209+ This method is configured for general-purpose printing. By default, it enables
1210+ soft wrap and disables Rich's automatic detection for markup, emoji, and highlighting.
1211+ These defaults can be overridden by passing explicit keyword arguments.
1212+
12061213 :param file: file stream being written to
12071214 :param objects: objects to print
12081215 :param sep: string to write between printed text. Defaults to " ".
12091216 :param end: string to write at end of printed text. Defaults to a newline.
12101217 :param style: optional style to apply to output
1211- :param soft_wrap: Enable soft wrap mode. If True, lines of text will not be word-wrapped or cropped to
1212- fit the terminal width. Defaults to True.
1218+ :param soft_wrap: Enable soft wrap mode. If True, lines of text will not be
1219+ word-wrapped or cropped to fit the terminal width. Defaults to True.
1220+ :param emoji: If True, Rich will replace emoji codes (e.g., :smiley:) with their
1221+ corresponding Unicode characters. Defaults to False.
1222+ :param markup: If True, Rich will interpret strings with tags (e.g., [bold]hello[/bold])
1223+ as styled output. Defaults to False.
1224+ :param highlight: If True, Rich will automatically apply highlighting to elements within
1225+ strings, such as common Python data types like numbers, booleans, or None.
1226+ This is particularly useful when pretty printing objects like lists and
1227+ dictionaries to display them in color. Defaults to False.
12131228 :param rich_print_kwargs: optional additional keyword arguments to pass to Rich's Console.print().
12141229 :param kwargs: Arbitrary keyword arguments. This allows subclasses to extend the signature of this
12151230 method and still call `super()` without encountering unexpected keyword argument errors.
12161231 These arguments are not passed to Rich's Console.print().
1232+
1233+ See the Rich documentation for more details on emoji codes, markup tags, and highlighting.
12171234 """
12181235 prepared_objects = ru .prepare_objects_for_rendering (* objects )
12191236
@@ -1224,6 +1241,9 @@ def print_to(
12241241 end = end ,
12251242 style = style ,
12261243 soft_wrap = soft_wrap ,
1244+ emoji = emoji ,
1245+ markup = markup ,
1246+ highlight = highlight ,
12271247 ** (rich_print_kwargs if rich_print_kwargs is not None else {}),
12281248 )
12291249 except BrokenPipeError :
@@ -1242,6 +1262,9 @@ def poutput(
12421262 end : str = "\n " ,
12431263 style : StyleType | None = None ,
12441264 soft_wrap : bool = True ,
1265+ emoji : bool = False ,
1266+ markup : bool = False ,
1267+ highlight : bool = False ,
12451268 rich_print_kwargs : RichPrintKwargs | None = None ,
12461269 ** kwargs : Any , # noqa: ARG002
12471270 ) -> None :
@@ -1256,6 +1279,9 @@ def poutput(
12561279 end = end ,
12571280 style = style ,
12581281 soft_wrap = soft_wrap ,
1282+ emoji = emoji ,
1283+ markup = markup ,
1284+ highlight = highlight ,
12591285 rich_print_kwargs = rich_print_kwargs ,
12601286 )
12611287
@@ -1266,6 +1292,9 @@ def perror(
12661292 end : str = "\n " ,
12671293 style : StyleType | None = Cmd2Style .ERROR ,
12681294 soft_wrap : bool = True ,
1295+ emoji : bool = False ,
1296+ markup : bool = False ,
1297+ highlight : bool = False ,
12691298 rich_print_kwargs : RichPrintKwargs | None = None ,
12701299 ** kwargs : Any , # noqa: ARG002
12711300 ) -> None :
@@ -1282,6 +1311,9 @@ def perror(
12821311 end = end ,
12831312 style = style ,
12841313 soft_wrap = soft_wrap ,
1314+ emoji = emoji ,
1315+ markup = markup ,
1316+ highlight = highlight ,
12851317 rich_print_kwargs = rich_print_kwargs ,
12861318 )
12871319
@@ -1291,6 +1323,9 @@ def psuccess(
12911323 sep : str = " " ,
12921324 end : str = "\n " ,
12931325 soft_wrap : bool = True ,
1326+ emoji : bool = False ,
1327+ markup : bool = False ,
1328+ highlight : bool = False ,
12941329 rich_print_kwargs : RichPrintKwargs | None = None ,
12951330 ** kwargs : Any , # noqa: ARG002
12961331 ) -> None :
@@ -1304,6 +1339,9 @@ def psuccess(
13041339 end = end ,
13051340 style = Cmd2Style .SUCCESS ,
13061341 soft_wrap = soft_wrap ,
1342+ emoji = emoji ,
1343+ markup = markup ,
1344+ highlight = highlight ,
13071345 rich_print_kwargs = rich_print_kwargs ,
13081346 )
13091347
@@ -1313,6 +1351,9 @@ def pwarning(
13131351 sep : str = " " ,
13141352 end : str = "\n " ,
13151353 soft_wrap : bool = True ,
1354+ emoji : bool = False ,
1355+ markup : bool = False ,
1356+ highlight : bool = False ,
13161357 rich_print_kwargs : RichPrintKwargs | None = None ,
13171358 ** kwargs : Any , # noqa: ARG002
13181359 ) -> None :
@@ -1326,6 +1367,9 @@ def pwarning(
13261367 end = end ,
13271368 style = Cmd2Style .WARNING ,
13281369 soft_wrap = soft_wrap ,
1370+ emoji = emoji ,
1371+ markup = markup ,
1372+ highlight = highlight ,
13291373 rich_print_kwargs = rich_print_kwargs ,
13301374 )
13311375
@@ -1390,6 +1434,9 @@ def pfeedback(
13901434 end : str = "\n " ,
13911435 style : StyleType | None = None ,
13921436 soft_wrap : bool = True ,
1437+ emoji : bool = False ,
1438+ markup : bool = False ,
1439+ highlight : bool = False ,
13931440 rich_print_kwargs : RichPrintKwargs | None = None ,
13941441 ** kwargs : Any , # noqa: ARG002
13951442 ) -> None :
@@ -1408,6 +1455,9 @@ def pfeedback(
14081455 end = end ,
14091456 style = style ,
14101457 soft_wrap = soft_wrap ,
1458+ emoji = emoji ,
1459+ markup = markup ,
1460+ highlight = highlight ,
14111461 rich_print_kwargs = rich_print_kwargs ,
14121462 )
14131463 else :
@@ -1417,6 +1467,9 @@ def pfeedback(
14171467 end = end ,
14181468 style = style ,
14191469 soft_wrap = soft_wrap ,
1470+ emoji = emoji ,
1471+ markup = markup ,
1472+ highlight = highlight ,
14201473 rich_print_kwargs = rich_print_kwargs ,
14211474 )
14221475
@@ -1428,6 +1481,9 @@ def ppaged(
14281481 style : StyleType | None = None ,
14291482 chop : bool = False ,
14301483 soft_wrap : bool = True ,
1484+ emoji : bool = False ,
1485+ markup : bool = False ,
1486+ highlight : bool = False ,
14311487 rich_print_kwargs : RichPrintKwargs | None = None ,
14321488 ** kwargs : Any , # noqa: ARG002
14331489 ) -> None :
@@ -1479,6 +1535,9 @@ def ppaged(
14791535 end = end ,
14801536 style = style ,
14811537 soft_wrap = soft_wrap ,
1538+ emoji = emoji ,
1539+ markup = markup ,
1540+ highlight = highlight ,
14821541 ** (rich_print_kwargs if rich_print_kwargs is not None else {}),
14831542 )
14841543 output_bytes = capture .get ().encode ('utf-8' , 'replace' )
@@ -1503,6 +1562,9 @@ def ppaged(
15031562 end = end ,
15041563 style = style ,
15051564 soft_wrap = soft_wrap ,
1565+ emoji = emoji ,
1566+ markup = markup ,
1567+ highlight = highlight ,
15061568 rich_print_kwargs = rich_print_kwargs ,
15071569 )
15081570
0 commit comments