cmd2 4.2.1__tar.gz → 4.2.2__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 (223) hide show
  1. {cmd2-4.2.1 → cmd2-4.2.2}/CHANGELOG.md +7 -2
  2. {cmd2-4.2.1 → cmd2-4.2.2}/PKG-INFO +1 -1
  3. {cmd2-4.2.1 → cmd2-4.2.2}/cmd2.egg-info/PKG-INFO +1 -1
  4. {cmd2-4.2.1 → cmd2-4.2.2}/cmd2.egg-info/SOURCES.txt +1 -0
  5. cmd2-4.2.2/cmd2.egg-info/scm_version.json +8 -0
  6. {cmd2-4.2.1 → cmd2-4.2.2}/docs/features/os.md +21 -33
  7. {cmd2-4.2.1 → cmd2-4.2.2}/docs/features/startup_commands.md +19 -6
  8. {cmd2-4.2.1 → cmd2-4.2.2}/examples/README.md +4 -2
  9. cmd2-4.2.2/examples/cmd2_history.dat +0 -0
  10. {cmd2-4.2.1 → cmd2-4.2.2}/examples/cmd_as_argument.py +13 -31
  11. cmd2-4.2.1/cmd2.egg-info/scm_version.json +0 -8
  12. {cmd2-4.2.1 → cmd2-4.2.2}/.pre-commit-config.yaml +0 -0
  13. {cmd2-4.2.1 → cmd2-4.2.2}/.prettierignore +0 -0
  14. {cmd2-4.2.1 → cmd2-4.2.2}/.prettierrc +0 -0
  15. {cmd2-4.2.1 → cmd2-4.2.2}/.typos.toml +0 -0
  16. {cmd2-4.2.1 → cmd2-4.2.2}/GEMINI.md +0 -0
  17. {cmd2-4.2.1 → cmd2-4.2.2}/LICENSE +0 -0
  18. {cmd2-4.2.1 → cmd2-4.2.2}/MANIFEST.in +0 -0
  19. {cmd2-4.2.1 → cmd2-4.2.2}/Makefile +0 -0
  20. {cmd2-4.2.1 → cmd2-4.2.2}/README.md +0 -0
  21. {cmd2-4.2.1 → cmd2-4.2.2}/cmd2/__init__.py +0 -0
  22. {cmd2-4.2.1 → cmd2-4.2.2}/cmd2/annotated.py +0 -0
  23. {cmd2-4.2.1 → cmd2-4.2.2}/cmd2/argparse_completer.py +0 -0
  24. {cmd2-4.2.1 → cmd2-4.2.2}/cmd2/argparse_utils.py +0 -0
  25. {cmd2-4.2.1 → cmd2-4.2.2}/cmd2/clipboard.py +0 -0
  26. {cmd2-4.2.1 → cmd2-4.2.2}/cmd2/cmd2.py +0 -0
  27. {cmd2-4.2.1 → cmd2-4.2.2}/cmd2/colors.py +0 -0
  28. {cmd2-4.2.1 → cmd2-4.2.2}/cmd2/command_set.py +0 -0
  29. {cmd2-4.2.1 → cmd2-4.2.2}/cmd2/completion.py +0 -0
  30. {cmd2-4.2.1 → cmd2-4.2.2}/cmd2/constants.py +0 -0
  31. {cmd2-4.2.1 → cmd2-4.2.2}/cmd2/decorators.py +0 -0
  32. {cmd2-4.2.1 → cmd2-4.2.2}/cmd2/exceptions.py +0 -0
  33. {cmd2-4.2.1 → cmd2-4.2.2}/cmd2/history.py +0 -0
  34. {cmd2-4.2.1 → cmd2-4.2.2}/cmd2/parsing.py +0 -0
  35. {cmd2-4.2.1 → cmd2-4.2.2}/cmd2/plugin.py +0 -0
  36. {cmd2-4.2.1 → cmd2-4.2.2}/cmd2/pt_utils.py +0 -0
  37. {cmd2-4.2.1 → cmd2-4.2.2}/cmd2/py.typed +0 -0
  38. {cmd2-4.2.1 → cmd2-4.2.2}/cmd2/py_bridge.py +0 -0
  39. {cmd2-4.2.1 → cmd2-4.2.2}/cmd2/rich_utils.py +0 -0
  40. {cmd2-4.2.1 → cmd2-4.2.2}/cmd2/string_utils.py +0 -0
  41. {cmd2-4.2.1 → cmd2-4.2.2}/cmd2/styles.py +0 -0
  42. {cmd2-4.2.1 → cmd2-4.2.2}/cmd2/theme.py +0 -0
  43. {cmd2-4.2.1 → cmd2-4.2.2}/cmd2/types.py +0 -0
  44. {cmd2-4.2.1 → cmd2-4.2.2}/cmd2/utils.py +0 -0
  45. {cmd2-4.2.1 → cmd2-4.2.2}/cmd2.egg-info/dependency_links.txt +0 -0
  46. {cmd2-4.2.1 → cmd2-4.2.2}/cmd2.egg-info/requires.txt +0 -0
  47. {cmd2-4.2.1 → cmd2-4.2.2}/cmd2.egg-info/scm_file_list.json +0 -0
  48. {cmd2-4.2.1 → cmd2-4.2.2}/cmd2.egg-info/top_level.txt +0 -0
  49. {cmd2-4.2.1 → cmd2-4.2.2}/cmd2.png +0 -0
  50. {cmd2-4.2.1 → cmd2-4.2.2}/codecov.yml +0 -0
  51. {cmd2-4.2.1 → cmd2-4.2.2}/docs/api/annotated.md +0 -0
  52. {cmd2-4.2.1 → cmd2-4.2.2}/docs/api/argparse_completer.md +0 -0
  53. {cmd2-4.2.1 → cmd2-4.2.2}/docs/api/argparse_utils.md +0 -0
  54. {cmd2-4.2.1 → cmd2-4.2.2}/docs/api/clipboard.md +0 -0
  55. {cmd2-4.2.1 → cmd2-4.2.2}/docs/api/cmd.md +0 -0
  56. {cmd2-4.2.1 → cmd2-4.2.2}/docs/api/colors.md +0 -0
  57. {cmd2-4.2.1 → cmd2-4.2.2}/docs/api/command_set.md +0 -0
  58. {cmd2-4.2.1 → cmd2-4.2.2}/docs/api/completion.md +0 -0
  59. {cmd2-4.2.1 → cmd2-4.2.2}/docs/api/constants.md +0 -0
  60. {cmd2-4.2.1 → cmd2-4.2.2}/docs/api/decorators.md +0 -0
  61. {cmd2-4.2.1 → cmd2-4.2.2}/docs/api/exceptions.md +0 -0
  62. {cmd2-4.2.1 → cmd2-4.2.2}/docs/api/history.md +0 -0
  63. {cmd2-4.2.1 → cmd2-4.2.2}/docs/api/index.md +0 -0
  64. {cmd2-4.2.1 → cmd2-4.2.2}/docs/api/parsing.md +0 -0
  65. {cmd2-4.2.1 → cmd2-4.2.2}/docs/api/plugin.md +0 -0
  66. {cmd2-4.2.1 → cmd2-4.2.2}/docs/api/pt_utils.md +0 -0
  67. {cmd2-4.2.1 → cmd2-4.2.2}/docs/api/py_bridge.md +0 -0
  68. {cmd2-4.2.1 → cmd2-4.2.2}/docs/api/rich_utils.md +0 -0
  69. {cmd2-4.2.1 → cmd2-4.2.2}/docs/api/string_utils.md +0 -0
  70. {cmd2-4.2.1 → cmd2-4.2.2}/docs/api/styles.md +0 -0
  71. {cmd2-4.2.1 → cmd2-4.2.2}/docs/api/theme.md +0 -0
  72. {cmd2-4.2.1 → cmd2-4.2.2}/docs/api/utils.md +0 -0
  73. {cmd2-4.2.1 → cmd2-4.2.2}/docs/doc_conventions.md +0 -0
  74. {cmd2-4.2.1 → cmd2-4.2.2}/docs/examples/alternate_event_loops.md +0 -0
  75. {cmd2-4.2.1 → cmd2-4.2.2}/docs/examples/examples.md +0 -0
  76. {cmd2-4.2.1 → cmd2-4.2.2}/docs/examples/getting_started.md +0 -0
  77. {cmd2-4.2.1 → cmd2-4.2.2}/docs/examples/index.md +0 -0
  78. {cmd2-4.2.1 → cmd2-4.2.2}/docs/features/annotated.md +0 -0
  79. {cmd2-4.2.1 → cmd2-4.2.2}/docs/features/argument_processing.md +0 -0
  80. {cmd2-4.2.1 → cmd2-4.2.2}/docs/features/async_commands.md +0 -0
  81. {cmd2-4.2.1 → cmd2-4.2.2}/docs/features/builtin_commands.md +0 -0
  82. {cmd2-4.2.1 → cmd2-4.2.2}/docs/features/clipboard.md +0 -0
  83. {cmd2-4.2.1 → cmd2-4.2.2}/docs/features/commands.md +0 -0
  84. {cmd2-4.2.1 → cmd2-4.2.2}/docs/features/completion.md +0 -0
  85. {cmd2-4.2.1 → cmd2-4.2.2}/docs/features/disable_commands.md +0 -0
  86. {cmd2-4.2.1 → cmd2-4.2.2}/docs/features/embedded_python_shells.md +0 -0
  87. {cmd2-4.2.1 → cmd2-4.2.2}/docs/features/generating_output.md +0 -0
  88. {cmd2-4.2.1 → cmd2-4.2.2}/docs/features/help.md +0 -0
  89. {cmd2-4.2.1 → cmd2-4.2.2}/docs/features/history.md +0 -0
  90. {cmd2-4.2.1 → cmd2-4.2.2}/docs/features/hooks.md +0 -0
  91. {cmd2-4.2.1 → cmd2-4.2.2}/docs/features/index.md +0 -0
  92. {cmd2-4.2.1 → cmd2-4.2.2}/docs/features/initialization.md +0 -0
  93. {cmd2-4.2.1 → cmd2-4.2.2}/docs/features/misc.md +0 -0
  94. {cmd2-4.2.1 → cmd2-4.2.2}/docs/features/modular_commands.md +0 -0
  95. {cmd2-4.2.1 → cmd2-4.2.2}/docs/features/multiline_commands.md +0 -0
  96. {cmd2-4.2.1 → cmd2-4.2.2}/docs/features/packaging.md +0 -0
  97. {cmd2-4.2.1 → cmd2-4.2.2}/docs/features/plugins.md +0 -0
  98. {cmd2-4.2.1 → cmd2-4.2.2}/docs/features/prompt.md +0 -0
  99. {cmd2-4.2.1 → cmd2-4.2.2}/docs/features/redirection.md +0 -0
  100. {cmd2-4.2.1 → cmd2-4.2.2}/docs/features/scripting.md +0 -0
  101. {cmd2-4.2.1 → cmd2-4.2.2}/docs/features/settings.md +0 -0
  102. {cmd2-4.2.1 → cmd2-4.2.2}/docs/features/shortcuts_aliases_macros.md +0 -0
  103. {cmd2-4.2.1 → cmd2-4.2.2}/docs/features/table_creation.md +0 -0
  104. {cmd2-4.2.1 → cmd2-4.2.2}/docs/features/theme.md +0 -0
  105. {cmd2-4.2.1 → cmd2-4.2.2}/docs/index.md +0 -0
  106. {cmd2-4.2.1 → cmd2-4.2.2}/docs/javascripts/readthedocs.js +0 -0
  107. {cmd2-4.2.1 → cmd2-4.2.2}/docs/migrating/incompatibilities.md +0 -0
  108. {cmd2-4.2.1 → cmd2-4.2.2}/docs/migrating/index.md +0 -0
  109. {cmd2-4.2.1 → cmd2-4.2.2}/docs/migrating/minimum.md +0 -0
  110. {cmd2-4.2.1 → cmd2-4.2.2}/docs/migrating/next_steps.md +0 -0
  111. {cmd2-4.2.1 → cmd2-4.2.2}/docs/migrating/why.md +0 -0
  112. {cmd2-4.2.1 → cmd2-4.2.2}/docs/mixins/index.md +0 -0
  113. {cmd2-4.2.1 → cmd2-4.2.2}/docs/mixins/mixin_template.md +0 -0
  114. {cmd2-4.2.1 → cmd2-4.2.2}/docs/overrides/main.html +0 -0
  115. {cmd2-4.2.1 → cmd2-4.2.2}/docs/overview/alternatives.md +0 -0
  116. {cmd2-4.2.1 → cmd2-4.2.2}/docs/overview/index.md +0 -0
  117. {cmd2-4.2.1 → cmd2-4.2.2}/docs/overview/installation.md +0 -0
  118. {cmd2-4.2.1 → cmd2-4.2.2}/docs/overview/integrating.md +0 -0
  119. {cmd2-4.2.1 → cmd2-4.2.2}/docs/overview/resources.md +0 -0
  120. {cmd2-4.2.1 → cmd2-4.2.2}/docs/stylesheets/cmd2.css +0 -0
  121. {cmd2-4.2.1 → cmd2-4.2.2}/docs/testing.md +0 -0
  122. {cmd2-4.2.1 → cmd2-4.2.2}/docs/upgrades.md +0 -0
  123. {cmd2-4.2.1 → cmd2-4.2.2}/examples/.cmd2rc +0 -0
  124. {cmd2-4.2.1 → cmd2-4.2.2}/examples/annotated_example.py +0 -0
  125. {cmd2-4.2.1 → cmd2-4.2.2}/examples/argparse_completion.py +0 -0
  126. {cmd2-4.2.1 → cmd2-4.2.2}/examples/argparse_example.py +0 -0
  127. {cmd2-4.2.1 → cmd2-4.2.2}/examples/async_call.py +0 -0
  128. {cmd2-4.2.1 → cmd2-4.2.2}/examples/async_commands.py +0 -0
  129. {cmd2-4.2.1 → cmd2-4.2.2}/examples/async_printing.py +0 -0
  130. {cmd2-4.2.1 → cmd2-4.2.2}/examples/basic_completion.py +0 -0
  131. {cmd2-4.2.1 → cmd2-4.2.2}/examples/color.py +0 -0
  132. {cmd2-4.2.1 → cmd2-4.2.2}/examples/command_sets.py +0 -0
  133. {cmd2-4.2.1 → cmd2-4.2.2}/examples/completion_item_choices.py +0 -0
  134. {cmd2-4.2.1 → cmd2-4.2.2}/examples/custom_parser.py +0 -0
  135. {cmd2-4.2.1 → cmd2-4.2.2}/examples/custom_types.py +0 -0
  136. {cmd2-4.2.1 → cmd2-4.2.2}/examples/default_categories.py +0 -0
  137. {cmd2-4.2.1 → cmd2-4.2.2}/examples/dynamic_commands.py +0 -0
  138. {cmd2-4.2.1 → cmd2-4.2.2}/examples/environment.py +0 -0
  139. {cmd2-4.2.1 → cmd2-4.2.2}/examples/event_loops.py +0 -0
  140. {cmd2-4.2.1 → cmd2-4.2.2}/examples/exit_code.py +0 -0
  141. {cmd2-4.2.1 → cmd2-4.2.2}/examples/getting_started.py +0 -0
  142. {cmd2-4.2.1 → cmd2-4.2.2}/examples/hello_cmd2.py +0 -0
  143. {cmd2-4.2.1 → cmd2-4.2.2}/examples/help_categories.py +0 -0
  144. {cmd2-4.2.1 → cmd2-4.2.2}/examples/hooks.py +0 -0
  145. {cmd2-4.2.1 → cmd2-4.2.2}/examples/migrating.py +0 -0
  146. {cmd2-4.2.1 → cmd2-4.2.2}/examples/mixin.py +0 -0
  147. {cmd2-4.2.1 → cmd2-4.2.2}/examples/modular_commands/__init__.py +0 -0
  148. {cmd2-4.2.1 → cmd2-4.2.2}/examples/modular_commands/commandset_basic.py +0 -0
  149. {cmd2-4.2.1 → cmd2-4.2.2}/examples/modular_commands/commandset_complex.py +0 -0
  150. {cmd2-4.2.1 → cmd2-4.2.2}/examples/modular_commands/commandset_custominit.py +0 -0
  151. {cmd2-4.2.1 → cmd2-4.2.2}/examples/modular_commandsets.py +0 -0
  152. {cmd2-4.2.1 → cmd2-4.2.2}/examples/paged_output.py +0 -0
  153. {cmd2-4.2.1 → cmd2-4.2.2}/examples/persistent_history.py +0 -0
  154. {cmd2-4.2.1 → cmd2-4.2.2}/examples/pretty_print.py +0 -0
  155. {cmd2-4.2.1 → cmd2-4.2.2}/examples/python_scripting.py +0 -0
  156. {cmd2-4.2.1 → cmd2-4.2.2}/examples/read_input.py +0 -0
  157. {cmd2-4.2.1 → cmd2-4.2.2}/examples/remove_builtin_commands.py +0 -0
  158. {cmd2-4.2.1 → cmd2-4.2.2}/examples/remove_settable.py +0 -0
  159. {cmd2-4.2.1 → cmd2-4.2.2}/examples/rich_tables.py +0 -0
  160. {cmd2-4.2.1 → cmd2-4.2.2}/examples/rich_theme.py +0 -0
  161. {cmd2-4.2.1 → cmd2-4.2.2}/examples/scripts/arg_printer.py +0 -0
  162. {cmd2-4.2.1 → cmd2-4.2.2}/examples/scripts/conditional.py +0 -0
  163. {cmd2-4.2.1 → cmd2-4.2.2}/examples/scripts/nested.txt +0 -0
  164. {cmd2-4.2.1 → cmd2-4.2.2}/examples/scripts/quit.txt +0 -0
  165. {cmd2-4.2.1 → cmd2-4.2.2}/examples/scripts/save_help_text.py +0 -0
  166. {cmd2-4.2.1 → cmd2-4.2.2}/examples/scripts/script.py +0 -0
  167. {cmd2-4.2.1 → cmd2-4.2.2}/examples/scripts/script.txt +0 -0
  168. {cmd2-4.2.1 → cmd2-4.2.2}/examples/tmux_launch.sh +0 -0
  169. {cmd2-4.2.1 → cmd2-4.2.2}/examples/tmux_split.sh +0 -0
  170. {cmd2-4.2.1 → cmd2-4.2.2}/examples/unicode_commands.py +0 -0
  171. {cmd2-4.2.1 → cmd2-4.2.2}/mkdocs.yml +0 -0
  172. {cmd2-4.2.1 → cmd2-4.2.2}/package.json +0 -0
  173. {cmd2-4.2.1 → cmd2-4.2.2}/pyproject.toml +0 -0
  174. {cmd2-4.2.1 → cmd2-4.2.2}/ruff.toml +0 -0
  175. {cmd2-4.2.1 → cmd2-4.2.2}/scripts/validate_tag.py +0 -0
  176. {cmd2-4.2.1 → cmd2-4.2.2}/setup.cfg +0 -0
  177. {cmd2-4.2.1 → cmd2-4.2.2}/tests/.cmd2rc +0 -0
  178. {cmd2-4.2.1 → cmd2-4.2.2}/tests/__init__.py +0 -0
  179. {cmd2-4.2.1 → cmd2-4.2.2}/tests/conftest.py +0 -0
  180. {cmd2-4.2.1 → cmd2-4.2.2}/tests/pyscript/echo.py +0 -0
  181. {cmd2-4.2.1 → cmd2-4.2.2}/tests/pyscript/environment.py +0 -0
  182. {cmd2-4.2.1 → cmd2-4.2.2}/tests/pyscript/help.py +0 -0
  183. {cmd2-4.2.1 → cmd2-4.2.2}/tests/pyscript/py_locals.py +0 -0
  184. {cmd2-4.2.1 → cmd2-4.2.2}/tests/pyscript/pyscript_dir.py +0 -0
  185. {cmd2-4.2.1 → cmd2-4.2.2}/tests/pyscript/raises_exception.py +0 -0
  186. {cmd2-4.2.1 → cmd2-4.2.2}/tests/pyscript/recursive.py +0 -0
  187. {cmd2-4.2.1 → cmd2-4.2.2}/tests/pyscript/self_in_py.py +0 -0
  188. {cmd2-4.2.1 → cmd2-4.2.2}/tests/pyscript/stop.py +0 -0
  189. {cmd2-4.2.1 → cmd2-4.2.2}/tests/pyscript/test_print.py +0 -0
  190. {cmd2-4.2.1 → cmd2-4.2.2}/tests/relative_multiple.txt +0 -0
  191. {cmd2-4.2.1 → cmd2-4.2.2}/tests/script.py +0 -0
  192. {cmd2-4.2.1 → cmd2-4.2.2}/tests/script.txt +0 -0
  193. {cmd2-4.2.1 → cmd2-4.2.2}/tests/scripts/binary.bin +0 -0
  194. {cmd2-4.2.1 → cmd2-4.2.2}/tests/scripts/empty.txt +0 -0
  195. {cmd2-4.2.1 → cmd2-4.2.2}/tests/scripts/help.txt +0 -0
  196. {cmd2-4.2.1 → cmd2-4.2.2}/tests/scripts/nested.txt +0 -0
  197. {cmd2-4.2.1 → cmd2-4.2.2}/tests/scripts/one_down.txt +0 -0
  198. {cmd2-4.2.1 → cmd2-4.2.2}/tests/scripts/postcmds.txt +0 -0
  199. {cmd2-4.2.1 → cmd2-4.2.2}/tests/scripts/precmds.txt +0 -0
  200. {cmd2-4.2.1 → cmd2-4.2.2}/tests/scripts/utf8.txt +0 -0
  201. {cmd2-4.2.1 → cmd2-4.2.2}/tests/test_annotated.py +0 -0
  202. {cmd2-4.2.1 → cmd2-4.2.2}/tests/test_argparse.py +0 -0
  203. {cmd2-4.2.1 → cmd2-4.2.2}/tests/test_argparse_completer.py +0 -0
  204. {cmd2-4.2.1 → cmd2-4.2.2}/tests/test_argparse_subcommands.py +0 -0
  205. {cmd2-4.2.1 → cmd2-4.2.2}/tests/test_argparse_utils.py +0 -0
  206. {cmd2-4.2.1 → cmd2-4.2.2}/tests/test_categories.py +0 -0
  207. {cmd2-4.2.1 → cmd2-4.2.2}/tests/test_cmd2.py +0 -0
  208. {cmd2-4.2.1 → cmd2-4.2.2}/tests/test_commandset.py +0 -0
  209. {cmd2-4.2.1 → cmd2-4.2.2}/tests/test_completion.py +0 -0
  210. {cmd2-4.2.1 → cmd2-4.2.2}/tests/test_dynamic_complete_style.py +0 -0
  211. {cmd2-4.2.1 → cmd2-4.2.2}/tests/test_future_annotations.py +0 -0
  212. {cmd2-4.2.1 → cmd2-4.2.2}/tests/test_history.py +0 -0
  213. {cmd2-4.2.1 → cmd2-4.2.2}/tests/test_parsing.py +0 -0
  214. {cmd2-4.2.1 → cmd2-4.2.2}/tests/test_plugin.py +0 -0
  215. {cmd2-4.2.1 → cmd2-4.2.2}/tests/test_pt_utils.py +0 -0
  216. {cmd2-4.2.1 → cmd2-4.2.2}/tests/test_py_completion.py +0 -0
  217. {cmd2-4.2.1 → cmd2-4.2.2}/tests/test_rich_utils.py +0 -0
  218. {cmd2-4.2.1 → cmd2-4.2.2}/tests/test_run_pyscript.py +0 -0
  219. {cmd2-4.2.1 → cmd2-4.2.2}/tests/test_string_utils.py +0 -0
  220. {cmd2-4.2.1 → cmd2-4.2.2}/tests/test_theme.py +0 -0
  221. {cmd2-4.2.1 → cmd2-4.2.2}/tests/test_utils.py +0 -0
  222. {cmd2-4.2.1 → cmd2-4.2.2}/tests/test_utils_defining_class.py +0 -0
  223. {cmd2-4.2.1 → cmd2-4.2.2}/ty.toml +0 -0
@@ -1,9 +1,14 @@
1
+ ## 4.2.2 (August 25, 2026)
2
+
3
+ - Documentation Improvements
4
+ - Improved documentation in attempt at making some recommended best-practices more discoverable
5
+ - Fixed the broken `cmd_as_argument` example
6
+
1
7
  ## 4.2.1 (August 22, 2026)
2
8
 
3
9
  - Enhancements
4
10
  - Added bracketed paste support so multiple pasted commands execute sequentially and multiline
5
11
  commands continue as expected.
6
-
7
12
  - Bug Fixes
8
13
  - Enabled Ctrl-Z suspension at the prompt
9
14
 
@@ -1895,7 +1900,7 @@ time reading the [rich documentation](https://rich.readthedocs.io/).
1895
1900
  - **with_argument_list** decorator to change argument type from str to List[str]
1896
1901
  - **do\_\*** commands get a single argument which is a list of strings, as pre-parsed by
1897
1902
  shlex.split()
1898
- - **with_arparser** decorator for strict argparse-based argument parsing of command
1903
+ - **with_argparser** decorator for strict argparse-based argument parsing of command
1899
1904
  arguments
1900
1905
  - **do\_\*** commands get a single argument which is the output of argparse.parse_args()
1901
1906
  - **with_argparser_and_unknown_args** decorator for argparse-based argument parsing, but
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cmd2
3
- Version: 4.2.1
3
+ Version: 4.2.2
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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cmd2
3
- Version: 4.2.1
3
+ Version: 4.2.2
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
@@ -129,6 +129,7 @@ examples/async_call.py
129
129
  examples/async_commands.py
130
130
  examples/async_printing.py
131
131
  examples/basic_completion.py
132
+ examples/cmd2_history.dat
132
133
  examples/cmd_as_argument.py
133
134
  examples/color.py
134
135
  examples/command_sets.py
@@ -0,0 +1,8 @@
1
+ {
2
+ "tag": "4.2.2",
3
+ "distance": 0,
4
+ "node": "g5dcbcbeda3a766ce226ad1c163c150f287f03f0b",
5
+ "dirty": false,
6
+ "branch": "main",
7
+ "node_date": "2026-08-25"
8
+ }
@@ -75,25 +75,25 @@ Either of these methods will launch your program and enter the `cmd2` command lo
75
75
  user to enter commands, which are then executed by your program.
76
76
 
77
77
  You may want to execute commands in your program without prompting the user for any input. There are
78
- several ways you might accomplish this task. The easiest one is to pipe commands and their arguments
79
- into your program via standard input. You don't need to do anything to your program in order to use
80
- this technique. Here's a demonstration using the `examples/cmd_as_argument.py` included in the
81
- source code of `cmd2`:
78
+ several ways you might accomplish this task. One is to pipe commands and their arguments into your
79
+ program via standard input. You don't need to do anything to your program in order to use this
80
+ technique. Here's a demonstration using the `examples/cmd_as_argument.py` included in the source
81
+ code of `cmd2`:
82
82
 
83
- $ echo "speak -p some words" | python examples/cmd_as_argument.py
83
+ $ echo "speak -p some words" | uv run examples/cmd_as_argument.py
84
84
  omesay ordsway
85
85
 
86
86
  Using this same approach you could create a text file containing the commands you would like to run,
87
87
  one command per line in the file. Say your file was called `somecmds.txt`. To run the commands in
88
88
  the text file using your `cmd2` program (from a Windows command prompt):
89
89
 
90
- c:\cmd2> type somecmds.txt | python.exe examples/cmd_as_argument.py
90
+ c:\cmd2> type somecmds.txt | uv run examples/cmd_as_argument.py
91
91
  omesay ordsway
92
92
 
93
93
  By default, `cmd2` programs also look for commands passed as arguments from the operating system
94
94
  shell, and execute those commands before entering the command loop:
95
95
 
96
- $ python examples/cmd_as_argument.py help
96
+ $ uv run examples/cmd_as_argument.py help
97
97
 
98
98
  Documented Commands
99
99
  ───────────────────
@@ -105,35 +105,23 @@ shell, and execute those commands before entering the command loop:
105
105
  You may need more control over command line arguments passed from the operating system shell. For
106
106
  example, you might have a command inside your `cmd2` program which itself accepts arguments, and
107
107
  maybe even option strings. Say you wanted to run the `speak` command from the operating system
108
- shell, but have it say it in pig latin:
109
-
110
- $ python examples/cmd_as_argument.py speak -p hello there
111
- python cmd_as_argument.py speak -p hello there
112
- usage: speak [-h] [-p] [-s] [-r REPEAT] words [words ...]
113
- speak: error: the following arguments are required: words
114
- *** Unknown syntax: -p
115
- *** Unknown syntax: hello
116
- *** Unknown syntax: there
117
- (Cmd)
118
-
119
- Uh-oh, that's not what we wanted. `cmd2` treated `-p`, `hello`, and `there` as commands, which don't
120
- exist in that program, thus the syntax errors.
121
-
122
- There is an easy way around this, which is demonstrated in
123
- [cmd_as_argument.py](https://github.com/python-cmd2/cmd2/blob/main/examples/cmd_as_argument.py)
124
- example. By setting `allow_cli_args=False` you can do your own argument parsing of the command line:
108
+ shell, but have it say it in pig latin - just group the command and its arguments inside either
109
+ double or single quotes:
125
110
 
126
- $ python examples/cmd_as_argument.py speak -p hello there
111
+ $ uv run examples/cmd_as_argument.py "speak -p hello there"
127
112
  ellohay heretay
113
+ (Cmd)
128
114
 
129
- Check the source code of this example, especially the `main()` function, to see the technique.
115
+ If you want to start your application using a custom `argparse` parser to collect high-level
116
+ application arguments but still want to be able to pass extra unknown arguments as commands at
117
+ invocation, then see the
118
+ [argparse_example.py](https://github.com/python-cmd2/cmd2/blob/main/examples/argparse_example.py)
119
+ example. Using this methodology you can call it like so:
130
120
 
131
- Alternatively you can simply wrap the command plus arguments in quotes (either single or double
132
- quotes):
121
+ $ uv run examples/argparse_example.py -c blue help
133
122
 
134
- $ python examples/cmd_as_argument.py "speak -p hello there"
135
- ellohay heretay
136
- (Cmd)
123
+ Check the source code of this example, especially the `if __name__ == "__main__":` block, to see the
124
+ technique.
137
125
 
138
126
  ### Automating cmd2 apps from other CLI/CLU tools
139
127
 
@@ -150,13 +138,13 @@ This is easily achieved by combining the following capabilities of `cmd2`:
150
138
  Here is a simple example which doesn't require the quit command since the custom `exit` command
151
139
  quits while returning an exit code:
152
140
 
153
- $ python examples/exit_code.py "exit 23"
141
+ $ uv run examples/exit_code.py "exit 23"
154
142
  'examples/exit_code.py' exiting with code: 23
155
143
  $ echo $?
156
144
  23
157
145
 
158
146
  Here is another example using `quit`:
159
147
 
160
- $ python examples/cmd_as_argument.py "speak -p hello there" quit
148
+ $ uv run examples/cmd_as_argument.py "speak -p hello there" quit
161
149
  ellohay heretay
162
150
  $
@@ -11,12 +11,12 @@ initializing so they are guaranteed to run before any _Commands At Invocation_.
11
11
 
12
12
  ## Commands At Invocation
13
13
 
14
- You can send commands to your app as you invoke it by including them as extra arguments to the
15
- program. `cmd2` interprets each argument as a separate command, so you should enclose each command
16
- in quotation marks if it is more than a one-word command. You can use either single or double quotes
17
- for this purpose.
14
+ By default, users can send commands to your app as you invoke it by including them as extra
15
+ arguments to the program. `cmd2` interprets each argument as a separate command, so you should
16
+ enclose each command in quotation marks if it is more than a one-word command. You can use either
17
+ single or double quotes for this purpose.
18
18
 
19
- $ python examples/cmd_as_argument.py "say hello" "say Gracie" quit
19
+ $ uv run examples/cmd_as_argument.py "say hello" "say Gracie" quit
20
20
  hello
21
21
  Gracie
22
22
 
@@ -26,7 +26,9 @@ application and easily used in automation.
26
26
 
27
27
  !!! note
28
28
 
29
- If you wish to disable cmd2's consumption of command-line arguments, you can do so by setting the `allow_cli_args` argument of your [cmd2.Cmd][] class instance to `False`. This would be useful, for example, if you wish to use something like [argparse](https://docs.python.org/3/library/argparse.html) to parse the overall command line arguments for your application:
29
+ If you wish to disable cmd2's consumption of command-line arguments, you can do so by setting the `allow_cli_args` argument of your [cmd2.Cmd][] class instance to `False`.
30
+ This would be useful, for example, if you wish to use something like [argparse](https://docs.python.org/3/library/argparse.html) to parse the overall command line arguments
31
+ for your application:
30
32
 
31
33
  ```py
32
34
  from cmd2 import Cmd
@@ -35,6 +37,17 @@ application and easily used in automation.
35
37
  super().__init__(allow_cli_args=False)
36
38
  ```
37
39
 
40
+ !!! tip
41
+
42
+ If you want to use something like [argparse](https://docs.python.org/3/library/argparse.html) to parse the overall command line arguments for your application
43
+ but still want to be able to pass any extra arguments to your application as commands, then see the `if __name__ == "__main__":` block at the end of the
44
+ [argparse_example.py](https://github.com/python-cmd2/cmd2/blob/main/examples/argparse_example.py) example.
45
+
46
+ This can be run like so:
47
+ ```sh
48
+ uv run examples/argparse_example.py -c blue help quit
49
+ ```
50
+
38
51
  ## Startup Script
39
52
 
40
53
  You can execute commands from an initialization script by passing a file path to the
@@ -17,6 +17,8 @@ each:
17
17
  - Comprehensive example demonstrating various aspects of using
18
18
  [argparse](https://docs.python.org/3/library/argparse.html) for command argument processing
19
19
  via the `cmd2.with_argparser` decorator
20
+ - Also demonstrates how to use a custom `argparse` parser when invoking your application and
21
+ still pass commands at invocation
20
22
  - [async_call.py](https://github.com/python-cmd2/cmd2/blob/main/examples/async_call.py)
21
23
  - Shows how to make a call to an async function from a cmd2 command.
22
24
  - [async_commands.py](https://github.com/python-cmd2/cmd2/blob/main/examples/async_commands.py)
@@ -26,8 +28,8 @@ each:
26
28
  title
27
29
  - [basic_completion.py](https://github.com/python-cmd2/cmd2/blob/main/examples/basic_completion.py)
28
30
  - Show how to enable custom tab completion by assigning a completer function to `do_*` commands
29
- - [cmd2_as_argument.py](https://github.com/python-cmd2/cmd2/blob/main/examples/cmd_as_argument.py)
30
- - Demonstrates how to accept and parse command-line arguments when invoking a cmd2 application
31
+ - [cmd_as_argument.py](https://github.com/python-cmd2/cmd2/blob/main/examples/cmd_as_argument.py)
32
+ - Demonstrates how to accept command-line arguments when invoking a cmd2 application
31
33
  - [color.py](https://github.com/python-cmd2/cmd2/blob/main/examples/color.py)
32
34
  - Show the numerous colors available to use in your cmd2 applications
33
35
  - [command_sets.py](https://github.com/python-cmd2/cmd2/blob/main/examples/command_sets.py)
Binary file
@@ -1,13 +1,17 @@
1
1
  #!/usr/bin/env python
2
2
  """A sample application for cmd2.
3
3
 
4
- This example has additional code in main() that shows how to accept a command from
5
- the command line at invocation:
4
+ This example relies on the `allow_cli_args` init parameter being `True` by default which allows passing commands on the
5
+ command line to execute when the application is invoked.
6
6
 
7
- $ python cmd_as_argument.py speak -p hello there
7
+ This can be run like so:
8
+ $ python cmd_as_argument.py "speak -p hello there" help
9
+
10
+ By default, the application will enter the interactive shell mode after executing the commands passed in on the command line.
11
+ You can have it exit after executing by providing `quit` as the last command.
12
+ Commands and arguments can be grouped together by including in quotes.
8
13
  """
9
14
 
10
- import argparse
11
15
  import secrets
12
16
 
13
17
  import cmd2
@@ -24,7 +28,7 @@ class CmdLineApp(cmd2.Cmd):
24
28
  shortcuts = dict(cmd2.DEFAULT_SHORTCUTS)
25
29
  shortcuts.update({"&": "speak"})
26
30
  # Set include_ipy to True to enable the "ipy" command which runs an interactive IPython shell
27
- super().__init__(allow_cli_args=False, include_ipy=True, multiline_commands=["orate"], shortcuts=shortcuts)
31
+ super().__init__(allow_cli_args=True, include_ipy=True, multiline_commands=["orate"], shortcuts=shortcuts)
28
32
 
29
33
  self.self_in_py = True
30
34
  self.maxrepeats = 3
@@ -45,8 +49,8 @@ class CmdLineApp(cmd2.Cmd):
45
49
  """Repeats what you tell me to."""
46
50
  words = []
47
51
  for w in args.words:
48
- word = w.copy()
49
- if args.piglatin:
52
+ word = w.strip()
53
+ if args.piglatin and word:
50
54
  word = f"{word[1:]}{word[0]}ay"
51
55
  if args.shout:
52
56
  word = word.upper()
@@ -80,30 +84,8 @@ class CmdLineApp(cmd2.Cmd):
80
84
  self.poutput(" ".join(output))
81
85
 
82
86
 
83
- def main(argv=None):
84
- """Run when invoked from the operating system shell."""
85
- parser = cmd2.Cmd2ArgumentParser(description="Commands as arguments")
86
- command_help = "optional command to run, if no command given, enter an interactive shell"
87
- parser.add_argument("command", nargs="?", help=command_help)
88
- arg_help = "optional arguments for command"
89
- parser.add_argument("command_args", nargs=argparse.REMAINDER, help=arg_help)
90
-
91
- args = parser.parse_args(argv)
92
-
93
- c = CmdLineApp()
94
-
95
- sys_exit_code = 0
96
- if args.command:
97
- # we have a command, run it and then exit
98
- c.onecmd_plus_hooks("{} {}".format(args.command, " ".join(args.command_args)))
99
- else:
100
- # we have no command, drop into interactive mode
101
- sys_exit_code = c.cmdloop()
102
-
103
- return sys_exit_code
104
-
105
-
106
87
  if __name__ == "__main__":
107
88
  import sys
108
89
 
109
- sys.exit(main())
90
+ app = CmdLineApp()
91
+ sys.exit(app.cmdloop())
@@ -1,8 +0,0 @@
1
- {
2
- "tag": "4.2.1",
3
- "distance": 0,
4
- "node": "g4ffa00ee1630cdc010c4e3a5ed9010cdf96c66ba",
5
- "dirty": false,
6
- "branch": "main",
7
- "node_date": "2026-08-22"
8
- }
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
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
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