File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -146,7 +146,7 @@ prompt is displayed.
146146 - The ` print() ` function available in a ` pyscript ` writes to ` self.stdout ` and respects the
147147 ` allow_style ` setting. It also supports printing ` Rich ` objects.
148148 - Added ` Cmd2ArgumentParser.output_to() ` context manager to temporarily set the output stream.
149- This is helpful for redirecting output from functions like ` parse_args() ` , which default to
149+ This is helpful for directing output for functions like ` parse_args() ` , which default to
150150 ` sys.stdout ` and lack a ` file ` argument.
151151
152152## 3.5.1 (April 24, 2026)
Original file line number Diff line number Diff line change @@ -571,7 +571,7 @@ class Cmd2ArgumentParser(argparse.ArgumentParser):
571571 def output_to (self , file : IO [str ] | None ) -> Iterator [None ]:
572572 """Context manager to temporarily set the output stream during argparse operations.
573573
574- This is helpful for redirecting output from functions like `parse_args()`, which
574+ This is helpful for directing output for functions like `parse_args()`, which
575575 default to `sys.stdout` and lack a `file` argument.
576576
577577 :param file: the file stream to use for output
Original file line number Diff line number Diff line change @@ -639,7 +639,7 @@ def test_parser_output_to_context_manager() -> None:
639639 assert parser ._thread_locals .current_output_file is None # type: ignore[unreachable]
640640
641641
642- def test_parser_print_help_redirection (mocker : MockerFixture ) -> None :
642+ def test_parser_print_help_output_to (mocker : MockerFixture ) -> None :
643643 """Test that print_help(file=my_file) correctly sets the context for the formatter."""
644644 import io
645645
@@ -662,7 +662,7 @@ def test_parser_print_help_redirection(mocker: MockerFixture) -> None:
662662 mock_formatter_class .assert_called_with (prog = "test" , file = buf )
663663
664664
665- def test_parser_error_redirection (mocker : MockerFixture ) -> None :
665+ def test_parser_error_output_to (mocker : MockerFixture ) -> None :
666666 """Test that error() shadows to sys.stderr and uses it for styling."""
667667 from cmd2 import rich_utils
668668
@@ -699,7 +699,7 @@ def test_parser_error_redirection(mocker: MockerFixture) -> None:
699699 assert kwargs ["style" ] == argparse_utils .Cmd2Style .ERROR
700700
701701
702- def test_parser_implicit_output_redirection (mocker : MockerFixture ) -> None :
702+ def test_parser_implicit_output_to (mocker : MockerFixture ) -> None :
703703 """Test that print_help() and print_usage() use thread-local context when no file is provided."""
704704 import io
705705
You can’t perform that action at this time.
0 commit comments