cmd2 3.2.2__tar.gz → 3.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (229) hide show
  1. {cmd2-3.2.2 → cmd2-3.3.0}/CHANGELOG.md +13 -0
  2. {cmd2-3.2.2 → cmd2-3.3.0}/PKG-INFO +1 -1
  3. {cmd2-3.2.2 → cmd2-3.3.0}/cmd2/cmd2.py +108 -49
  4. {cmd2-3.2.2 → cmd2-3.3.0}/cmd2/rich_utils.py +35 -14
  5. {cmd2-3.2.2 → cmd2-3.3.0}/cmd2.egg-info/PKG-INFO +1 -1
  6. {cmd2-3.2.2 → cmd2-3.3.0}/cmd2.egg-info/SOURCES.txt +1 -0
  7. cmd2-3.3.0/examples/cmd2_history.dat +0 -0
  8. {cmd2-3.2.2 → cmd2-3.3.0}/tests/test_cmd2.py +17 -3
  9. {cmd2-3.2.2 → cmd2-3.3.0}/.pre-commit-config.yaml +0 -0
  10. {cmd2-3.2.2 → cmd2-3.3.0}/.prettierignore +0 -0
  11. {cmd2-3.2.2 → cmd2-3.3.0}/.prettierrc +0 -0
  12. {cmd2-3.2.2 → cmd2-3.3.0}/GEMINI.md +0 -0
  13. {cmd2-3.2.2 → cmd2-3.3.0}/LICENSE +0 -0
  14. {cmd2-3.2.2 → cmd2-3.3.0}/MANIFEST.in +0 -0
  15. {cmd2-3.2.2 → cmd2-3.3.0}/Makefile +0 -0
  16. {cmd2-3.2.2 → cmd2-3.3.0}/README.md +0 -0
  17. {cmd2-3.2.2 → cmd2-3.3.0}/cmd2/__init__.py +0 -0
  18. {cmd2-3.2.2 → cmd2-3.3.0}/cmd2/argparse_completer.py +0 -0
  19. {cmd2-3.2.2 → cmd2-3.3.0}/cmd2/argparse_custom.py +0 -0
  20. {cmd2-3.2.2 → cmd2-3.3.0}/cmd2/clipboard.py +0 -0
  21. {cmd2-3.2.2 → cmd2-3.3.0}/cmd2/colors.py +0 -0
  22. {cmd2-3.2.2 → cmd2-3.3.0}/cmd2/command_definition.py +0 -0
  23. {cmd2-3.2.2 → cmd2-3.3.0}/cmd2/constants.py +0 -0
  24. {cmd2-3.2.2 → cmd2-3.3.0}/cmd2/decorators.py +0 -0
  25. {cmd2-3.2.2 → cmd2-3.3.0}/cmd2/exceptions.py +0 -0
  26. {cmd2-3.2.2 → cmd2-3.3.0}/cmd2/history.py +0 -0
  27. {cmd2-3.2.2 → cmd2-3.3.0}/cmd2/parsing.py +0 -0
  28. {cmd2-3.2.2 → cmd2-3.3.0}/cmd2/plugin.py +0 -0
  29. {cmd2-3.2.2 → cmd2-3.3.0}/cmd2/py.typed +0 -0
  30. {cmd2-3.2.2 → cmd2-3.3.0}/cmd2/py_bridge.py +0 -0
  31. {cmd2-3.2.2 → cmd2-3.3.0}/cmd2/rl_utils.py +0 -0
  32. {cmd2-3.2.2 → cmd2-3.3.0}/cmd2/string_utils.py +0 -0
  33. {cmd2-3.2.2 → cmd2-3.3.0}/cmd2/styles.py +0 -0
  34. {cmd2-3.2.2 → cmd2-3.3.0}/cmd2/terminal_utils.py +0 -0
  35. {cmd2-3.2.2 → cmd2-3.3.0}/cmd2/transcript.py +0 -0
  36. {cmd2-3.2.2 → cmd2-3.3.0}/cmd2/utils.py +0 -0
  37. {cmd2-3.2.2 → cmd2-3.3.0}/cmd2.egg-info/dependency_links.txt +0 -0
  38. {cmd2-3.2.2 → cmd2-3.3.0}/cmd2.egg-info/requires.txt +0 -0
  39. {cmd2-3.2.2 → cmd2-3.3.0}/cmd2.egg-info/top_level.txt +0 -0
  40. {cmd2-3.2.2 → cmd2-3.3.0}/cmd2.png +0 -0
  41. {cmd2-3.2.2 → cmd2-3.3.0}/codecov.yml +0 -0
  42. {cmd2-3.2.2 → cmd2-3.3.0}/docs/api/argparse_completer.md +0 -0
  43. {cmd2-3.2.2 → cmd2-3.3.0}/docs/api/argparse_custom.md +0 -0
  44. {cmd2-3.2.2 → cmd2-3.3.0}/docs/api/clipboard.md +0 -0
  45. {cmd2-3.2.2 → cmd2-3.3.0}/docs/api/cmd.md +0 -0
  46. {cmd2-3.2.2 → cmd2-3.3.0}/docs/api/colors.md +0 -0
  47. {cmd2-3.2.2 → cmd2-3.3.0}/docs/api/command_definition.md +0 -0
  48. {cmd2-3.2.2 → cmd2-3.3.0}/docs/api/constants.md +0 -0
  49. {cmd2-3.2.2 → cmd2-3.3.0}/docs/api/decorators.md +0 -0
  50. {cmd2-3.2.2 → cmd2-3.3.0}/docs/api/exceptions.md +0 -0
  51. {cmd2-3.2.2 → cmd2-3.3.0}/docs/api/history.md +0 -0
  52. {cmd2-3.2.2 → cmd2-3.3.0}/docs/api/index.md +0 -0
  53. {cmd2-3.2.2 → cmd2-3.3.0}/docs/api/parsing.md +0 -0
  54. {cmd2-3.2.2 → cmd2-3.3.0}/docs/api/plugin.md +0 -0
  55. {cmd2-3.2.2 → cmd2-3.3.0}/docs/api/py_bridge.md +0 -0
  56. {cmd2-3.2.2 → cmd2-3.3.0}/docs/api/rich_utils.md +0 -0
  57. {cmd2-3.2.2 → cmd2-3.3.0}/docs/api/rl_utils.md +0 -0
  58. {cmd2-3.2.2 → cmd2-3.3.0}/docs/api/string_utils.md +0 -0
  59. {cmd2-3.2.2 → cmd2-3.3.0}/docs/api/styles.md +0 -0
  60. {cmd2-3.2.2 → cmd2-3.3.0}/docs/api/terminal_utils.md +0 -0
  61. {cmd2-3.2.2 → cmd2-3.3.0}/docs/api/transcript.md +0 -0
  62. {cmd2-3.2.2 → cmd2-3.3.0}/docs/api/utils.md +0 -0
  63. {cmd2-3.2.2 → cmd2-3.3.0}/docs/doc_conventions.md +0 -0
  64. {cmd2-3.2.2 → cmd2-3.3.0}/docs/examples/alternate_event_loops.md +0 -0
  65. {cmd2-3.2.2 → cmd2-3.3.0}/docs/examples/examples.md +0 -0
  66. {cmd2-3.2.2 → cmd2-3.3.0}/docs/examples/getting_started.md +0 -0
  67. {cmd2-3.2.2 → cmd2-3.3.0}/docs/examples/index.md +0 -0
  68. {cmd2-3.2.2 → cmd2-3.3.0}/docs/features/argument_processing.md +0 -0
  69. {cmd2-3.2.2 → cmd2-3.3.0}/docs/features/builtin_commands.md +0 -0
  70. {cmd2-3.2.2 → cmd2-3.3.0}/docs/features/clipboard.md +0 -0
  71. {cmd2-3.2.2 → cmd2-3.3.0}/docs/features/commands.md +0 -0
  72. {cmd2-3.2.2 → cmd2-3.3.0}/docs/features/completion.md +0 -0
  73. {cmd2-3.2.2 → cmd2-3.3.0}/docs/features/disable_commands.md +0 -0
  74. {cmd2-3.2.2 → cmd2-3.3.0}/docs/features/embedded_python_shells.md +0 -0
  75. {cmd2-3.2.2 → cmd2-3.3.0}/docs/features/generating_output.md +0 -0
  76. {cmd2-3.2.2 → cmd2-3.3.0}/docs/features/help.md +0 -0
  77. {cmd2-3.2.2 → cmd2-3.3.0}/docs/features/history.md +0 -0
  78. {cmd2-3.2.2 → cmd2-3.3.0}/docs/features/hooks.md +0 -0
  79. {cmd2-3.2.2 → cmd2-3.3.0}/docs/features/index.md +0 -0
  80. {cmd2-3.2.2 → cmd2-3.3.0}/docs/features/initialization.md +0 -0
  81. {cmd2-3.2.2 → cmd2-3.3.0}/docs/features/misc.md +0 -0
  82. {cmd2-3.2.2 → cmd2-3.3.0}/docs/features/modular_commands.md +0 -0
  83. {cmd2-3.2.2 → cmd2-3.3.0}/docs/features/multiline_commands.md +0 -0
  84. {cmd2-3.2.2 → cmd2-3.3.0}/docs/features/os.md +0 -0
  85. {cmd2-3.2.2 → cmd2-3.3.0}/docs/features/packaging.md +0 -0
  86. {cmd2-3.2.2 → cmd2-3.3.0}/docs/features/plugins.md +0 -0
  87. {cmd2-3.2.2 → cmd2-3.3.0}/docs/features/prompt.md +0 -0
  88. {cmd2-3.2.2 → cmd2-3.3.0}/docs/features/redirection.md +0 -0
  89. {cmd2-3.2.2 → cmd2-3.3.0}/docs/features/scripting.md +0 -0
  90. {cmd2-3.2.2 → cmd2-3.3.0}/docs/features/settings.md +0 -0
  91. {cmd2-3.2.2 → cmd2-3.3.0}/docs/features/shortcuts_aliases_macros.md +0 -0
  92. {cmd2-3.2.2 → cmd2-3.3.0}/docs/features/startup_commands.md +0 -0
  93. {cmd2-3.2.2 → cmd2-3.3.0}/docs/features/table_creation.md +0 -0
  94. {cmd2-3.2.2 → cmd2-3.3.0}/docs/features/theme.md +0 -0
  95. {cmd2-3.2.2 → cmd2-3.3.0}/docs/features/transcripts.md +0 -0
  96. {cmd2-3.2.2 → cmd2-3.3.0}/docs/index.md +0 -0
  97. {cmd2-3.2.2 → cmd2-3.3.0}/docs/javascripts/readthedocs.js +0 -0
  98. {cmd2-3.2.2 → cmd2-3.3.0}/docs/migrating/incompatibilities.md +0 -0
  99. {cmd2-3.2.2 → cmd2-3.3.0}/docs/migrating/index.md +0 -0
  100. {cmd2-3.2.2 → cmd2-3.3.0}/docs/migrating/minimum.md +0 -0
  101. {cmd2-3.2.2 → cmd2-3.3.0}/docs/migrating/next_steps.md +0 -0
  102. {cmd2-3.2.2 → cmd2-3.3.0}/docs/migrating/why.md +0 -0
  103. {cmd2-3.2.2 → cmd2-3.3.0}/docs/mixins/index.md +0 -0
  104. {cmd2-3.2.2 → cmd2-3.3.0}/docs/mixins/mixin_template.md +0 -0
  105. {cmd2-3.2.2 → cmd2-3.3.0}/docs/overrides/main.html +0 -0
  106. {cmd2-3.2.2 → cmd2-3.3.0}/docs/overview/alternatives.md +0 -0
  107. {cmd2-3.2.2 → cmd2-3.3.0}/docs/overview/index.md +0 -0
  108. {cmd2-3.2.2 → cmd2-3.3.0}/docs/overview/installation.md +0 -0
  109. {cmd2-3.2.2 → cmd2-3.3.0}/docs/overview/integrating.md +0 -0
  110. {cmd2-3.2.2 → cmd2-3.3.0}/docs/overview/resources.md +0 -0
  111. {cmd2-3.2.2 → cmd2-3.3.0}/docs/stylesheets/cmd2.css +0 -0
  112. {cmd2-3.2.2 → cmd2-3.3.0}/docs/testing.md +0 -0
  113. {cmd2-3.2.2 → cmd2-3.3.0}/docs/upgrades.md +0 -0
  114. {cmd2-3.2.2 → cmd2-3.3.0}/examples/.cmd2rc +0 -0
  115. {cmd2-3.2.2 → cmd2-3.3.0}/examples/README.md +0 -0
  116. {cmd2-3.2.2 → cmd2-3.3.0}/examples/argparse_completion.py +0 -0
  117. {cmd2-3.2.2 → cmd2-3.3.0}/examples/argparse_example.py +0 -0
  118. {cmd2-3.2.2 → cmd2-3.3.0}/examples/async_call.py +0 -0
  119. {cmd2-3.2.2 → cmd2-3.3.0}/examples/async_printing.py +0 -0
  120. {cmd2-3.2.2 → cmd2-3.3.0}/examples/basic_completion.py +0 -0
  121. {cmd2-3.2.2 → cmd2-3.3.0}/examples/cmd_as_argument.py +0 -0
  122. {cmd2-3.2.2 → cmd2-3.3.0}/examples/color.py +0 -0
  123. {cmd2-3.2.2 → cmd2-3.3.0}/examples/command_sets.py +0 -0
  124. {cmd2-3.2.2 → cmd2-3.3.0}/examples/custom_parser.py +0 -0
  125. {cmd2-3.2.2 → cmd2-3.3.0}/examples/custom_types.py +0 -0
  126. {cmd2-3.2.2 → cmd2-3.3.0}/examples/default_categories.py +0 -0
  127. {cmd2-3.2.2 → cmd2-3.3.0}/examples/dynamic_commands.py +0 -0
  128. {cmd2-3.2.2 → cmd2-3.3.0}/examples/environment.py +0 -0
  129. {cmd2-3.2.2 → cmd2-3.3.0}/examples/event_loops.py +0 -0
  130. {cmd2-3.2.2 → cmd2-3.3.0}/examples/exit_code.py +0 -0
  131. {cmd2-3.2.2 → cmd2-3.3.0}/examples/getting_started.py +0 -0
  132. {cmd2-3.2.2 → cmd2-3.3.0}/examples/hello_cmd2.py +0 -0
  133. {cmd2-3.2.2 → cmd2-3.3.0}/examples/help_categories.py +0 -0
  134. {cmd2-3.2.2 → cmd2-3.3.0}/examples/hooks.py +0 -0
  135. {cmd2-3.2.2 → cmd2-3.3.0}/examples/migrating.py +0 -0
  136. {cmd2-3.2.2 → cmd2-3.3.0}/examples/mixin.py +0 -0
  137. {cmd2-3.2.2 → cmd2-3.3.0}/examples/modular_commands/__init__.py +0 -0
  138. {cmd2-3.2.2 → cmd2-3.3.0}/examples/modular_commands/commandset_basic.py +0 -0
  139. {cmd2-3.2.2 → cmd2-3.3.0}/examples/modular_commands/commandset_complex.py +0 -0
  140. {cmd2-3.2.2 → cmd2-3.3.0}/examples/modular_commands/commandset_custominit.py +0 -0
  141. {cmd2-3.2.2 → cmd2-3.3.0}/examples/modular_commands.py +0 -0
  142. {cmd2-3.2.2 → cmd2-3.3.0}/examples/paged_output.py +0 -0
  143. {cmd2-3.2.2 → cmd2-3.3.0}/examples/persistent_history.py +0 -0
  144. {cmd2-3.2.2 → cmd2-3.3.0}/examples/pretty_print.py +0 -0
  145. {cmd2-3.2.2 → cmd2-3.3.0}/examples/python_scripting.py +0 -0
  146. {cmd2-3.2.2 → cmd2-3.3.0}/examples/read_input.py +0 -0
  147. {cmd2-3.2.2 → cmd2-3.3.0}/examples/remove_builtin_commands.py +0 -0
  148. {cmd2-3.2.2 → cmd2-3.3.0}/examples/remove_settable.py +0 -0
  149. {cmd2-3.2.2 → cmd2-3.3.0}/examples/rich_tables.py +0 -0
  150. {cmd2-3.2.2 → cmd2-3.3.0}/examples/rich_theme.py +0 -0
  151. {cmd2-3.2.2 → cmd2-3.3.0}/examples/scripts/arg_printer.py +0 -0
  152. {cmd2-3.2.2 → cmd2-3.3.0}/examples/scripts/conditional.py +0 -0
  153. {cmd2-3.2.2 → cmd2-3.3.0}/examples/scripts/nested.txt +0 -0
  154. {cmd2-3.2.2 → cmd2-3.3.0}/examples/scripts/quit.txt +0 -0
  155. {cmd2-3.2.2 → cmd2-3.3.0}/examples/scripts/save_help_text.py +0 -0
  156. {cmd2-3.2.2 → cmd2-3.3.0}/examples/scripts/script.py +0 -0
  157. {cmd2-3.2.2 → cmd2-3.3.0}/examples/scripts/script.txt +0 -0
  158. {cmd2-3.2.2 → cmd2-3.3.0}/examples/tmux_launch.sh +0 -0
  159. {cmd2-3.2.2 → cmd2-3.3.0}/examples/tmux_split.sh +0 -0
  160. {cmd2-3.2.2 → cmd2-3.3.0}/examples/transcript_example.py +0 -0
  161. {cmd2-3.2.2 → cmd2-3.3.0}/examples/transcripts/exampleSession.txt +0 -0
  162. {cmd2-3.2.2 → cmd2-3.3.0}/examples/transcripts/pirate.transcript +0 -0
  163. {cmd2-3.2.2 → cmd2-3.3.0}/examples/transcripts/quit.txt +0 -0
  164. {cmd2-3.2.2 → cmd2-3.3.0}/examples/transcripts/transcript_regex.txt +0 -0
  165. {cmd2-3.2.2 → cmd2-3.3.0}/examples/unicode_commands.py +0 -0
  166. {cmd2-3.2.2 → cmd2-3.3.0}/mkdocs.yml +0 -0
  167. {cmd2-3.2.2 → cmd2-3.3.0}/package.json +0 -0
  168. {cmd2-3.2.2 → cmd2-3.3.0}/pyproject.toml +0 -0
  169. {cmd2-3.2.2 → cmd2-3.3.0}/ruff.toml +0 -0
  170. {cmd2-3.2.2 → cmd2-3.3.0}/scripts/validate_tag.py +0 -0
  171. {cmd2-3.2.2 → cmd2-3.3.0}/setup.cfg +0 -0
  172. {cmd2-3.2.2 → cmd2-3.3.0}/tests/.cmd2rc +0 -0
  173. {cmd2-3.2.2 → cmd2-3.3.0}/tests/__init__.py +0 -0
  174. {cmd2-3.2.2 → cmd2-3.3.0}/tests/conftest.py +0 -0
  175. {cmd2-3.2.2 → cmd2-3.3.0}/tests/pyscript/echo.py +0 -0
  176. {cmd2-3.2.2 → cmd2-3.3.0}/tests/pyscript/environment.py +0 -0
  177. {cmd2-3.2.2 → cmd2-3.3.0}/tests/pyscript/help.py +0 -0
  178. {cmd2-3.2.2 → cmd2-3.3.0}/tests/pyscript/py_locals.py +0 -0
  179. {cmd2-3.2.2 → cmd2-3.3.0}/tests/pyscript/pyscript_dir.py +0 -0
  180. {cmd2-3.2.2 → cmd2-3.3.0}/tests/pyscript/raises_exception.py +0 -0
  181. {cmd2-3.2.2 → cmd2-3.3.0}/tests/pyscript/recursive.py +0 -0
  182. {cmd2-3.2.2 → cmd2-3.3.0}/tests/pyscript/self_in_py.py +0 -0
  183. {cmd2-3.2.2 → cmd2-3.3.0}/tests/pyscript/stdout_capture.py +0 -0
  184. {cmd2-3.2.2 → cmd2-3.3.0}/tests/pyscript/stop.py +0 -0
  185. {cmd2-3.2.2 → cmd2-3.3.0}/tests/relative_multiple.txt +0 -0
  186. {cmd2-3.2.2 → cmd2-3.3.0}/tests/script.py +0 -0
  187. {cmd2-3.2.2 → cmd2-3.3.0}/tests/script.txt +0 -0
  188. {cmd2-3.2.2 → cmd2-3.3.0}/tests/scripts/binary.bin +0 -0
  189. {cmd2-3.2.2 → cmd2-3.3.0}/tests/scripts/empty.txt +0 -0
  190. {cmd2-3.2.2 → cmd2-3.3.0}/tests/scripts/help.txt +0 -0
  191. {cmd2-3.2.2 → cmd2-3.3.0}/tests/scripts/nested.txt +0 -0
  192. {cmd2-3.2.2 → cmd2-3.3.0}/tests/scripts/one_down.txt +0 -0
  193. {cmd2-3.2.2 → cmd2-3.3.0}/tests/scripts/postcmds.txt +0 -0
  194. {cmd2-3.2.2 → cmd2-3.3.0}/tests/scripts/precmds.txt +0 -0
  195. {cmd2-3.2.2 → cmd2-3.3.0}/tests/scripts/utf8.txt +0 -0
  196. {cmd2-3.2.2 → cmd2-3.3.0}/tests/test_argparse.py +0 -0
  197. {cmd2-3.2.2 → cmd2-3.3.0}/tests/test_argparse_completer.py +0 -0
  198. {cmd2-3.2.2 → cmd2-3.3.0}/tests/test_argparse_custom.py +0 -0
  199. {cmd2-3.2.2 → cmd2-3.3.0}/tests/test_argparse_subcommands.py +0 -0
  200. {cmd2-3.2.2 → cmd2-3.3.0}/tests/test_async_alert.py +0 -0
  201. {cmd2-3.2.2 → cmd2-3.3.0}/tests/test_categories.py +0 -0
  202. {cmd2-3.2.2 → cmd2-3.3.0}/tests/test_commandset.py +0 -0
  203. {cmd2-3.2.2 → cmd2-3.3.0}/tests/test_completion.py +0 -0
  204. {cmd2-3.2.2 → cmd2-3.3.0}/tests/test_future_annotations.py +0 -0
  205. {cmd2-3.2.2 → cmd2-3.3.0}/tests/test_history.py +0 -0
  206. {cmd2-3.2.2 → cmd2-3.3.0}/tests/test_parsing.py +0 -0
  207. {cmd2-3.2.2 → cmd2-3.3.0}/tests/test_plugin.py +0 -0
  208. {cmd2-3.2.2 → cmd2-3.3.0}/tests/test_rich_utils.py +0 -0
  209. {cmd2-3.2.2 → cmd2-3.3.0}/tests/test_run_pyscript.py +0 -0
  210. {cmd2-3.2.2 → cmd2-3.3.0}/tests/test_string_utils.py +0 -0
  211. {cmd2-3.2.2 → cmd2-3.3.0}/tests/test_terminal_utils.py +0 -0
  212. {cmd2-3.2.2 → cmd2-3.3.0}/tests/test_transcript.py +0 -0
  213. {cmd2-3.2.2 → cmd2-3.3.0}/tests/test_utils.py +0 -0
  214. {cmd2-3.2.2 → cmd2-3.3.0}/tests/test_utils_defining_class.py +0 -0
  215. {cmd2-3.2.2 → cmd2-3.3.0}/tests/transcripts/bol_eol.txt +0 -0
  216. {cmd2-3.2.2 → cmd2-3.3.0}/tests/transcripts/characterclass.txt +0 -0
  217. {cmd2-3.2.2 → cmd2-3.3.0}/tests/transcripts/dotstar.txt +0 -0
  218. {cmd2-3.2.2 → cmd2-3.3.0}/tests/transcripts/extension_notation.txt +0 -0
  219. {cmd2-3.2.2 → cmd2-3.3.0}/tests/transcripts/failure.txt +0 -0
  220. {cmd2-3.2.2 → cmd2-3.3.0}/tests/transcripts/from_cmdloop.txt +0 -0
  221. {cmd2-3.2.2 → cmd2-3.3.0}/tests/transcripts/multiline_no_regex.txt +0 -0
  222. {cmd2-3.2.2 → cmd2-3.3.0}/tests/transcripts/multiline_regex.txt +0 -0
  223. {cmd2-3.2.2 → cmd2-3.3.0}/tests/transcripts/no_output.txt +0 -0
  224. {cmd2-3.2.2 → cmd2-3.3.0}/tests/transcripts/no_output_last.txt +0 -0
  225. {cmd2-3.2.2 → cmd2-3.3.0}/tests/transcripts/singleslash.txt +0 -0
  226. {cmd2-3.2.2 → cmd2-3.3.0}/tests/transcripts/slashes_escaped.txt +0 -0
  227. {cmd2-3.2.2 → cmd2-3.3.0}/tests/transcripts/slashslash.txt +0 -0
  228. {cmd2-3.2.2 → cmd2-3.3.0}/tests/transcripts/spaces.txt +0 -0
  229. {cmd2-3.2.2 → cmd2-3.3.0}/tests/transcripts/word_boundaries.txt +0 -0
@@ -1,3 +1,16 @@
1
+ # 3.3.0 (March 1, 2026)
2
+
3
+ - Enhancements
4
+ - Added ability to pass a console object to `Cmd.print_to()`. This provides support for things
5
+ like wrapping a `print_to()` call in a `console.status()` or `console.capture()` context
6
+ manager.
7
+
8
+ - Breaking Changes
9
+ - Renamed the `file` parameter of `Cmd.print_to()` to `destination` to support file-like objects
10
+ and console objects.
11
+ - `Cmd2BaseConsole(file)` argument is now a keyword-only argument to be consistent with the
12
+ `rich.console.Console` class.
13
+
1
14
  ## 3.2.2 (February 21, 2026)
2
15
 
3
16
  - Bug Fixes
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cmd2
3
- Version: 3.2.2
3
+ Version: 3.3.0
4
4
  Summary: cmd2 - quickly build feature-rich and user-friendly interactive command line applications in Python
5
5
  Author: cmd2 Contributors
6
6
  License-Expression: MIT
@@ -65,7 +65,11 @@ from typing import (
65
65
  )
66
66
 
67
67
  import rich.box
68
- from rich.console import Group, RenderableType
68
+ from rich.console import (
69
+ Console,
70
+ Group,
71
+ RenderableType,
72
+ )
69
73
  from rich.highlighter import ReprHighlighter
70
74
  from rich.rule import Rule
71
75
  from rich.style import Style, StyleType
@@ -133,6 +137,7 @@ from .parsing import (
133
137
  shlex_split,
134
138
  )
135
139
  from .rich_utils import (
140
+ Cmd2BaseConsole,
136
141
  Cmd2ExceptionConsole,
137
142
  Cmd2GeneralConsole,
138
143
  RichPrintKwargs,
@@ -165,7 +170,7 @@ from .utils import (
165
170
 
166
171
  # Set up readline
167
172
  if rl_type == RlType.NONE: # pragma: no cover
168
- Cmd2GeneralConsole(sys.stderr).print(rl_warning, style=Cmd2Style.WARNING)
173
+ Cmd2GeneralConsole(file=sys.stderr).print(rl_warning, style=Cmd2Style.WARNING)
169
174
  else:
170
175
  from .rl_utils import (
171
176
  readline,
@@ -1247,30 +1252,66 @@ class Cmd:
1247
1252
 
1248
1253
  def print_to(
1249
1254
  self,
1250
- file: IO[str],
1255
+ destination: IO[str] | Cmd2BaseConsole,
1251
1256
  *objects: Any,
1252
1257
  sep: str = " ",
1253
1258
  end: str = "\n",
1254
1259
  style: StyleType | None = None,
1255
- soft_wrap: bool = True,
1256
- emoji: bool = False,
1257
- markup: bool = False,
1258
- highlight: bool = False,
1260
+ soft_wrap: bool | None = None,
1261
+ emoji: bool | None = None,
1262
+ markup: bool | None = None,
1263
+ highlight: bool | None = None,
1259
1264
  rich_print_kwargs: RichPrintKwargs | None = None,
1260
1265
  **kwargs: Any, # noqa: ARG002
1261
1266
  ) -> None:
1262
- """Print objects to a given file stream.
1267
+ """Print objects to a given destination (file stream or cmd2 console).
1268
+
1269
+ If ``destination`` is a file-like object, it is wrapped in a ``Cmd2GeneralConsole``
1270
+ which is configured for general-purpose printing. By default, it enables soft wrap and
1271
+ disables Rich's automatic detection for markup, emoji, and highlighting. These defaults
1272
+ can be overridden by passing explicit keyword arguments.
1273
+
1274
+ If ``destination`` is a ``Cmd2BaseConsole``, the console's default settings for
1275
+ soft wrap, markup, emoji, and highlighting are used unless overridden by passing
1276
+ explicit keyword arguments.
1277
+
1278
+ See the Rich documentation for more details on emoji codes, markup tags, and highlighting.
1279
+
1280
+ **Why use this method instead of console.print()?**
1281
+
1282
+ This method calls ``cmd2.rich_utils.prepare_objects_for_rendering()`` on the objects
1283
+ being printed. This ensures that strings containing ANSI style sequences are converted
1284
+ to Rich Text objects, so that Rich can correctly calculate their display width when
1285
+ printing.
1286
+
1287
+ Example:
1288
+ ```py
1289
+ with console.capture() as capture:
1290
+ self.print_to(console, some_ansi_styled_string)
1291
+ ```
1292
+
1293
+ !!! note
1263
1294
 
1264
- This method is configured for general-purpose printing. By default, it enables
1265
- soft wrap and disables Rich's automatic detection for markup, emoji, and highlighting.
1266
- These defaults can be overridden by passing explicit keyword arguments.
1295
+ To ensure consistent behavior, this method requires a file-like object or
1296
+ an instance of ``Cmd2BaseConsole``.
1297
+ Consoles not derived from ``Cmd2BaseConsole`` are disallowed because:
1267
1298
 
1268
- :param file: file stream being written to
1299
+ 1. **Style Control**: They ignore the global ``ALLOW_STYLE`` setting.
1300
+ 2. **Theming**: They do not respect the application-wide ``APP_THEME``.
1301
+ 3. **Error Handling**: They trigger a ``SystemExit`` on broken pipes.
1302
+ ``Cmd2BaseConsole`` instead raises a catchable ``BrokenPipeError``,
1303
+ ensuring the CLI application remains alive if a pipe is closed.
1304
+
1305
+ :param destination: The output target. File-like objects are automatically
1306
+ wrapped in a ``Cmd2GeneralConsole`` to ensure they respect
1307
+ cmd2 global settings; otherwise, this must be an
1308
+ instance of ``Cmd2BaseConsole``.
1269
1309
  :param objects: objects to print
1270
1310
  :param sep: string to write between printed text. Defaults to " ".
1271
1311
  :param end: string to write at end of printed text. Defaults to a newline.
1272
1312
  :param style: optional style to apply to output
1273
- :param soft_wrap: Enable soft wrap mode. Defaults to True.
1313
+ :param soft_wrap: Enable soft wrap mode. Defaults to None.
1314
+ If None, the destination console's default behavior is used.
1274
1315
  If True, text that doesn't fit will run on to the following line,
1275
1316
  just like with print(). This is useful for raw text and logs.
1276
1317
  If False, Rich wraps text to fit the terminal width.
@@ -1279,24 +1320,43 @@ class Cmd:
1279
1320
  For example, when soft_wrap is True Panels truncate text
1280
1321
  which is wider than the terminal.
1281
1322
  :param emoji: If True, Rich will replace emoji codes (e.g., :smiley:) with their
1282
- corresponding Unicode characters. Defaults to False.
1323
+ corresponding Unicode characters. Defaults to None.
1324
+ If None, the destination console's default behavior is used.
1283
1325
  :param markup: If True, Rich will interpret strings with tags (e.g., [bold]hello[/bold])
1284
- as styled output. Defaults to False.
1326
+ as styled output. Defaults to None.
1327
+ If None, the destination console's default behavior is used.
1285
1328
  :param highlight: If True, Rich will automatically apply highlighting to elements within
1286
1329
  strings, such as common Python data types like numbers, booleans, or None.
1287
1330
  This is particularly useful when pretty printing objects like lists and
1288
- dictionaries to display them in color. Defaults to False.
1331
+ dictionaries to display them in color. Defaults to None.
1332
+ If None, the destination console's default behavior is used.
1289
1333
  :param rich_print_kwargs: optional additional keyword arguments to pass to Rich's Console.print().
1290
1334
  :param kwargs: Arbitrary keyword arguments. This allows subclasses to extend the signature of this
1291
1335
  method and still call `super()` without encountering unexpected keyword argument errors.
1292
1336
  These arguments are not passed to Rich's Console.print().
1337
+ :raises TypeError: If ``destination`` is a non-cmd2 ``Console`` instance that
1338
+ does not derive from ``Cmd2BaseConsole``.
1293
1339
 
1294
- See the Rich documentation for more details on emoji codes, markup tags, and highlighting.
1295
1340
  """
1341
+ if isinstance(destination, Console):
1342
+ if not isinstance(destination, Cmd2BaseConsole):
1343
+ # Explicitly reject non-cmd2 consoles to ensure safe behavior
1344
+ raise TypeError(
1345
+ f"destination must be a 'Cmd2BaseConsole' or a file-like object, "
1346
+ f"not a non-cmd2 '{type(destination).__name__}'. "
1347
+ "Consoles not derived from 'Cmd2BaseConsole' bypass cmd2's "
1348
+ "'ALLOW_STYLE' logic, 'APP_THEME' settings, and trigger 'SystemExit' "
1349
+ "on broken pipes."
1350
+ )
1351
+ console = destination
1352
+ else:
1353
+ # It's a file-like object (e.g., sys.stdout, StringIO)
1354
+ console = Cmd2GeneralConsole(file=destination)
1355
+
1296
1356
  prepared_objects = ru.prepare_objects_for_rendering(*objects)
1297
1357
 
1298
1358
  try:
1299
- Cmd2GeneralConsole(file).print(
1359
+ console.print(
1300
1360
  *prepared_objects,
1301
1361
  sep=sep,
1302
1362
  end=end,
@@ -1313,8 +1373,8 @@ class Cmd:
1313
1373
  # writing. If you would like your application to print a
1314
1374
  # warning message, then set the broken_pipe_warning attribute
1315
1375
  # to the message you want printed.
1316
- if self.broken_pipe_warning and file != sys.stderr:
1317
- Cmd2GeneralConsole(sys.stderr).print(self.broken_pipe_warning)
1376
+ if self.broken_pipe_warning and console.file != sys.stderr:
1377
+ Cmd2GeneralConsole(file=sys.stderr).print(self.broken_pipe_warning)
1318
1378
 
1319
1379
  def poutput(
1320
1380
  self,
@@ -1322,10 +1382,10 @@ class Cmd:
1322
1382
  sep: str = " ",
1323
1383
  end: str = "\n",
1324
1384
  style: StyleType | None = None,
1325
- soft_wrap: bool = True,
1326
- emoji: bool = False,
1327
- markup: bool = False,
1328
- highlight: bool = False,
1385
+ soft_wrap: bool | None = None,
1386
+ emoji: bool | None = None,
1387
+ markup: bool | None = None,
1388
+ highlight: bool | None = None,
1329
1389
  rich_print_kwargs: RichPrintKwargs | None = None,
1330
1390
  **kwargs: Any, # noqa: ARG002
1331
1391
  ) -> None:
@@ -1352,10 +1412,10 @@ class Cmd:
1352
1412
  sep: str = " ",
1353
1413
  end: str = "\n",
1354
1414
  style: StyleType | None = Cmd2Style.ERROR,
1355
- soft_wrap: bool = True,
1356
- emoji: bool = False,
1357
- markup: bool = False,
1358
- highlight: bool = False,
1415
+ soft_wrap: bool | None = None,
1416
+ emoji: bool | None = None,
1417
+ markup: bool | None = None,
1418
+ highlight: bool | None = None,
1359
1419
  rich_print_kwargs: RichPrintKwargs | None = None,
1360
1420
  **kwargs: Any, # noqa: ARG002
1361
1421
  ) -> None:
@@ -1383,10 +1443,10 @@ class Cmd:
1383
1443
  *objects: Any,
1384
1444
  sep: str = " ",
1385
1445
  end: str = "\n",
1386
- soft_wrap: bool = True,
1387
- emoji: bool = False,
1388
- markup: bool = False,
1389
- highlight: bool = False,
1446
+ soft_wrap: bool | None = None,
1447
+ emoji: bool | None = None,
1448
+ markup: bool | None = None,
1449
+ highlight: bool | None = None,
1390
1450
  rich_print_kwargs: RichPrintKwargs | None = None,
1391
1451
  **kwargs: Any, # noqa: ARG002
1392
1452
  ) -> None:
@@ -1411,10 +1471,10 @@ class Cmd:
1411
1471
  *objects: Any,
1412
1472
  sep: str = " ",
1413
1473
  end: str = "\n",
1414
- soft_wrap: bool = True,
1415
- emoji: bool = False,
1416
- markup: bool = False,
1417
- highlight: bool = False,
1474
+ soft_wrap: bool | None = None,
1475
+ emoji: bool | None = None,
1476
+ markup: bool | None = None,
1477
+ highlight: bool | None = None,
1418
1478
  rich_print_kwargs: RichPrintKwargs | None = None,
1419
1479
  **kwargs: Any, # noqa: ARG002
1420
1480
  ) -> None:
@@ -1447,7 +1507,7 @@ class Cmd:
1447
1507
  :param kwargs: Arbitrary keyword arguments. This allows subclasses to extend the signature of this
1448
1508
  method and still call `super()` without encountering unexpected keyword argument errors.
1449
1509
  """
1450
- console = Cmd2ExceptionConsole(sys.stderr)
1510
+ console = Cmd2ExceptionConsole(file=sys.stderr)
1451
1511
 
1452
1512
  # Only print a traceback if we're in debug mode and one exists.
1453
1513
  if self.debug and sys.exc_info() != (None, None, None):
@@ -1494,10 +1554,10 @@ class Cmd:
1494
1554
  sep: str = " ",
1495
1555
  end: str = "\n",
1496
1556
  style: StyleType | None = None,
1497
- soft_wrap: bool = True,
1498
- emoji: bool = False,
1499
- markup: bool = False,
1500
- highlight: bool = False,
1557
+ soft_wrap: bool | None = None,
1558
+ emoji: bool | None = None,
1559
+ markup: bool | None = None,
1560
+ highlight: bool | None = None,
1501
1561
  rich_print_kwargs: RichPrintKwargs | None = None,
1502
1562
  **kwargs: Any, # noqa: ARG002
1503
1563
  ) -> None:
@@ -1542,9 +1602,9 @@ class Cmd:
1542
1602
  style: StyleType | None = None,
1543
1603
  chop: bool = False,
1544
1604
  soft_wrap: bool = True,
1545
- emoji: bool = False,
1546
- markup: bool = False,
1547
- highlight: bool = False,
1605
+ emoji: bool | None = None,
1606
+ markup: bool | None = None,
1607
+ highlight: bool | None = None,
1548
1608
  rich_print_kwargs: RichPrintKwargs | None = None,
1549
1609
  **kwargs: Any, # noqa: ARG002
1550
1610
  ) -> None:
@@ -1581,17 +1641,16 @@ class Cmd:
1581
1641
 
1582
1642
  # Check if we are outputting to a pager.
1583
1643
  if functional_terminal and can_block:
1584
- prepared_objects = ru.prepare_objects_for_rendering(*objects)
1585
-
1586
1644
  # Chopping overrides soft_wrap
1587
1645
  if chop:
1588
1646
  soft_wrap = True
1589
1647
 
1590
1648
  # Generate the bytes to send to the pager
1591
- console = Cmd2GeneralConsole(self.stdout)
1649
+ console = Cmd2GeneralConsole(file=self.stdout)
1592
1650
  with console.capture() as capture:
1593
- console.print(
1594
- *prepared_objects,
1651
+ self.print_to(
1652
+ console,
1653
+ *objects,
1595
1654
  sep=sep,
1596
1655
  end=end,
1597
1656
  style=style,
@@ -124,6 +124,7 @@ class Cmd2BaseConsole(Console):
124
124
 
125
125
  def __init__(
126
126
  self,
127
+ *,
127
128
  file: IO[str] | None = None,
128
129
  **kwargs: Any,
129
130
  ) -> None:
@@ -180,17 +181,19 @@ class Cmd2BaseConsole(Console):
180
181
 
181
182
 
182
183
  class Cmd2GeneralConsole(Cmd2BaseConsole):
183
- """Rich console for general-purpose printing."""
184
+ """Rich console for general-purpose printing.
184
185
 
185
- def __init__(self, file: IO[str] | None = None) -> None:
186
+ It enables soft wrap and disables Rich's automatic detection for markup,
187
+ emoji, and highlighting. These defaults can be overridden in calls to the
188
+ console's or cmd2's print methods.
189
+ """
190
+
191
+ def __init__(self, *, file: IO[str] | None = None) -> None:
186
192
  """Cmd2GeneralConsole initializer.
187
193
 
188
194
  :param file: optional file object where the console should write to.
189
195
  Defaults to sys.stdout.
190
196
  """
191
- # This console is configured for general-purpose printing. It enables soft wrap
192
- # and disables Rich's automatic detection for markup, emoji, and highlighting.
193
- # These defaults can be overridden in calls to the console's or cmd2's print methods.
194
197
  super().__init__(
195
198
  file=file,
196
199
  soft_wrap=True,
@@ -203,23 +206,25 @@ class Cmd2GeneralConsole(Cmd2BaseConsole):
203
206
  class Cmd2RichArgparseConsole(Cmd2BaseConsole):
204
207
  """Rich console for rich-argparse output.
205
208
 
206
- This class ensures long lines in help text are not truncated by avoiding soft_wrap,
209
+ Ensures long lines in help text are not truncated by disabling soft_wrap,
207
210
  which conflicts with rich-argparse's explicit no_wrap and overflow settings.
211
+
212
+ Since this console is used to print error messages which may not be intended
213
+ for Rich formatting, it disables Rich's automatic detection for markup, emoji,
214
+ and highlighting. Because rich-argparse does markup and highlighting without
215
+ involving the console, disabling these settings does not affect the library's
216
+ internal functionality.
208
217
  """
209
218
 
210
- def __init__(self, file: IO[str] | None = None) -> None:
219
+ def __init__(self, *, file: IO[str] | None = None) -> None:
211
220
  """Cmd2RichArgparseConsole initializer.
212
221
 
213
222
  :param file: optional file object where the console should write to.
214
223
  Defaults to sys.stdout.
215
224
  """
216
- # Since this console is used to print error messages which may not have
217
- # been pre-formatted by rich-argparse, disable Rich's automatic detection
218
- # for markup, emoji, and highlighting. rich-argparse does markup and
219
- # highlighting without involving the console so these won't affect its
220
- # internal functionality.
221
225
  super().__init__(
222
226
  file=file,
227
+ soft_wrap=False,
223
228
  markup=False,
224
229
  emoji=False,
225
230
  highlight=False,
@@ -227,11 +232,27 @@ class Cmd2RichArgparseConsole(Cmd2BaseConsole):
227
232
 
228
233
 
229
234
  class Cmd2ExceptionConsole(Cmd2BaseConsole):
230
- """Rich console for printing exceptions.
235
+ """Rich console for printing exceptions and Rich Tracebacks.
231
236
 
232
- Ensures that long exception messages word wrap for readability by keeping soft_wrap disabled.
237
+ Ensures that output is always word-wrapped for readability and disables
238
+ Rich's automatic detection for markup, emoji, and highlighting to prevent
239
+ interference with raw error data.
233
240
  """
234
241
 
242
+ def __init__(self, *, file: IO[str] | None = None) -> None:
243
+ """Cmd2ExceptionConsole initializer.
244
+
245
+ :param file: optional file object where the console should write to.
246
+ Defaults to sys.stdout.
247
+ """
248
+ super().__init__(
249
+ file=file,
250
+ soft_wrap=False,
251
+ markup=False,
252
+ emoji=False,
253
+ highlight=False,
254
+ )
255
+
235
256
 
236
257
  def console_width() -> int:
237
258
  """Return the width of the console."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cmd2
3
- Version: 3.2.2
3
+ Version: 3.3.0
4
4
  Summary: cmd2 - quickly build feature-rich and user-friendly interactive command line applications in Python
5
5
  Author: cmd2 Contributors
6
6
  License-Expression: MIT
@@ -119,6 +119,7 @@ examples/argparse_example.py
119
119
  examples/async_call.py
120
120
  examples/async_printing.py
121
121
  examples/basic_completion.py
122
+ examples/cmd2_history.dat
122
123
  examples/cmd_as_argument.py
123
124
  examples/color.py
124
125
  examples/command_sets.py
Binary file
@@ -6,9 +6,7 @@ import os
6
6
  import signal
7
7
  import sys
8
8
  import tempfile
9
- from code import (
10
- InteractiveConsole,
11
- )
9
+ from code import InteractiveConsole
12
10
  from typing import NoReturn
13
11
  from unittest import mock
14
12
 
@@ -2130,6 +2128,22 @@ def test_read_command_line_eof(base_app, monkeypatch) -> None:
2130
2128
  assert line == 'eof'
2131
2129
 
2132
2130
 
2131
+ def test_print_to_custom_console(base_app) -> None:
2132
+ console = ru.Cmd2GeneralConsole()
2133
+ with console.capture() as capture:
2134
+ base_app.print_to(console, "hello")
2135
+ assert capture.get() == "hello\n"
2136
+
2137
+
2138
+ def test_print_to_invalid_console_type(base_app) -> None:
2139
+ from rich.console import Console
2140
+
2141
+ console = Console()
2142
+ with pytest.raises(TypeError) as excinfo:
2143
+ base_app.print_to(console, "hello")
2144
+ assert "destination must be a 'Cmd2BaseConsole'" in str(excinfo.value)
2145
+
2146
+
2133
2147
  def test_poutput_string(outsim_app) -> None:
2134
2148
  msg = 'This is a test'
2135
2149
  outsim_app.poutput(msg)
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes