cmd2 4.2.2__tar.gz → 4.2.4__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.
- {cmd2-4.2.2 → cmd2-4.2.4}/.pre-commit-config.yaml +3 -2
- cmd2-4.2.4/AGENTS.md +40 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/CHANGELOG.md +21 -0
- cmd2-4.2.4/CLAUDE.md +123 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/Makefile +12 -1
- {cmd2-4.2.2 → cmd2-4.2.4}/PKG-INFO +135 -85
- {cmd2-4.2.2 → cmd2-4.2.4}/README.md +134 -84
- {cmd2-4.2.2 → cmd2-4.2.4}/cmd2/annotated.py +116 -46
- {cmd2-4.2.2 → cmd2-4.2.4}/cmd2/argparse_completer.py +6 -6
- {cmd2-4.2.2 → cmd2-4.2.4}/cmd2/argparse_utils.py +14 -14
- {cmd2-4.2.2 → cmd2-4.2.4}/cmd2/cmd2.py +99 -49
- {cmd2-4.2.2 → cmd2-4.2.4}/cmd2/decorators.py +3 -2
- {cmd2-4.2.2 → cmd2-4.2.4}/cmd2/rich_utils.py +2 -2
- {cmd2-4.2.2 → cmd2-4.2.4}/cmd2/types.py +36 -3
- {cmd2-4.2.2 → cmd2-4.2.4}/cmd2/utils.py +1 -1
- {cmd2-4.2.2 → cmd2-4.2.4}/cmd2.egg-info/PKG-INFO +135 -85
- {cmd2-4.2.2 → cmd2-4.2.4}/cmd2.egg-info/SOURCES.txt +5 -1
- {cmd2-4.2.2 → cmd2-4.2.4}/cmd2.egg-info/scm_file_list.json +5 -2
- cmd2-4.2.4/cmd2.egg-info/scm_version.json +8 -0
- cmd2-4.2.4/docs/assets/cmd2-readme-demo.gif +0 -0
- cmd2-4.2.4/docs/assets/getting-started-demo.gif +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/examples/alternate_event_loops.md +3 -1
- cmd2-4.2.4/docs/examples/getting_started.md +289 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/features/annotated.md +40 -15
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/features/argument_processing.md +35 -26
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/features/async_commands.md +6 -1
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/features/builtin_commands.md +1 -1
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/features/commands.md +8 -2
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/features/disable_commands.md +12 -11
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/features/embedded_python_shells.md +4 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/features/help.md +16 -14
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/features/hooks.md +2 -2
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/features/initialization.md +2 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/features/misc.md +3 -3
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/features/modular_commands.md +58 -51
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/features/plugins.md +5 -3
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/features/prompt.md +9 -8
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/features/redirection.md +2 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/features/scripting.md +32 -31
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/features/settings.md +2 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/features/shortcuts_aliases_macros.md +1 -1
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/features/startup_commands.md +4 -2
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/mixins/mixin_template.md +3 -5
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/testing.md +4 -4
- {cmd2-4.2.2 → cmd2-4.2.4}/examples/getting_started.py +1 -1
- {cmd2-4.2.2 → cmd2-4.2.4}/pyproject.toml +32 -5
- {cmd2-4.2.2 → cmd2-4.2.4}/ruff.toml +1 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/tests/conftest.py +17 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/tests/test_annotated.py +61 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/tests/test_cmd2.py +37 -2
- {cmd2-4.2.2 → cmd2-4.2.4}/tests/test_run_pyscript.py +1 -1
- cmd2-4.2.4/tests/test_suite_environment.py +59 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/ty.toml +0 -1
- cmd2-4.2.2/cmd2.egg-info/scm_version.json +0 -8
- cmd2-4.2.2/cmd2.png +0 -0
- cmd2-4.2.2/docs/examples/getting_started.md +0 -303
- {cmd2-4.2.2 → cmd2-4.2.4}/.prettierignore +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/.prettierrc +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/.typos.toml +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/GEMINI.md +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/LICENSE +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/MANIFEST.in +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/cmd2/__init__.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/cmd2/clipboard.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/cmd2/colors.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/cmd2/command_set.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/cmd2/completion.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/cmd2/constants.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/cmd2/exceptions.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/cmd2/history.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/cmd2/parsing.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/cmd2/plugin.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/cmd2/pt_utils.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/cmd2/py.typed +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/cmd2/py_bridge.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/cmd2/string_utils.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/cmd2/styles.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/cmd2/theme.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/cmd2.egg-info/dependency_links.txt +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/cmd2.egg-info/requires.txt +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/cmd2.egg-info/top_level.txt +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/codecov.yml +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/api/annotated.md +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/api/argparse_completer.md +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/api/argparse_utils.md +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/api/clipboard.md +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/api/cmd.md +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/api/colors.md +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/api/command_set.md +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/api/completion.md +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/api/constants.md +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/api/decorators.md +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/api/exceptions.md +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/api/history.md +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/api/index.md +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/api/parsing.md +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/api/plugin.md +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/api/pt_utils.md +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/api/py_bridge.md +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/api/rich_utils.md +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/api/string_utils.md +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/api/styles.md +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/api/theme.md +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/api/utils.md +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/doc_conventions.md +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/examples/examples.md +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/examples/index.md +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/features/clipboard.md +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/features/completion.md +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/features/generating_output.md +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/features/history.md +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/features/index.md +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/features/multiline_commands.md +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/features/os.md +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/features/packaging.md +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/features/table_creation.md +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/features/theme.md +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/index.md +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/javascripts/readthedocs.js +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/migrating/incompatibilities.md +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/migrating/index.md +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/migrating/minimum.md +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/migrating/next_steps.md +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/migrating/why.md +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/mixins/index.md +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/overrides/main.html +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/overview/alternatives.md +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/overview/index.md +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/overview/installation.md +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/overview/integrating.md +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/overview/resources.md +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/stylesheets/cmd2.css +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/docs/upgrades.md +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/examples/.cmd2rc +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/examples/README.md +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/examples/annotated_example.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/examples/argparse_completion.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/examples/argparse_example.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/examples/async_call.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/examples/async_commands.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/examples/async_printing.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/examples/basic_completion.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/examples/cmd2_history.dat +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/examples/cmd_as_argument.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/examples/color.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/examples/command_sets.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/examples/completion_item_choices.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/examples/custom_parser.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/examples/custom_types.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/examples/default_categories.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/examples/dynamic_commands.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/examples/environment.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/examples/event_loops.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/examples/exit_code.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/examples/hello_cmd2.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/examples/help_categories.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/examples/hooks.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/examples/migrating.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/examples/mixin.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/examples/modular_commands/__init__.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/examples/modular_commands/commandset_basic.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/examples/modular_commands/commandset_complex.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/examples/modular_commands/commandset_custominit.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/examples/modular_commandsets.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/examples/paged_output.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/examples/persistent_history.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/examples/pretty_print.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/examples/python_scripting.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/examples/read_input.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/examples/remove_builtin_commands.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/examples/remove_settable.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/examples/rich_tables.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/examples/rich_theme.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/examples/scripts/arg_printer.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/examples/scripts/conditional.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/examples/scripts/nested.txt +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/examples/scripts/quit.txt +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/examples/scripts/save_help_text.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/examples/scripts/script.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/examples/scripts/script.txt +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/examples/tmux_launch.sh +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/examples/tmux_split.sh +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/examples/unicode_commands.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/mkdocs.yml +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/package.json +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/scripts/validate_tag.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/setup.cfg +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/tests/.cmd2rc +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/tests/__init__.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/tests/pyscript/echo.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/tests/pyscript/environment.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/tests/pyscript/help.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/tests/pyscript/py_locals.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/tests/pyscript/pyscript_dir.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/tests/pyscript/raises_exception.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/tests/pyscript/recursive.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/tests/pyscript/self_in_py.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/tests/pyscript/stop.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/tests/pyscript/test_print.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/tests/relative_multiple.txt +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/tests/script.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/tests/script.txt +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/tests/scripts/binary.bin +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/tests/scripts/empty.txt +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/tests/scripts/help.txt +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/tests/scripts/nested.txt +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/tests/scripts/one_down.txt +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/tests/scripts/postcmds.txt +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/tests/scripts/precmds.txt +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/tests/scripts/utf8.txt +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/tests/test_argparse.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/tests/test_argparse_completer.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/tests/test_argparse_subcommands.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/tests/test_argparse_utils.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/tests/test_categories.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/tests/test_commandset.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/tests/test_completion.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/tests/test_dynamic_complete_style.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/tests/test_future_annotations.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/tests/test_history.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/tests/test_parsing.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/tests/test_plugin.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/tests/test_pt_utils.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/tests/test_py_completion.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/tests/test_rich_utils.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/tests/test_string_utils.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/tests/test_theme.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/tests/test_utils.py +0 -0
- {cmd2-4.2.2 → cmd2-4.2.4}/tests/test_utils_defining_class.py +0 -0
|
@@ -7,6 +7,7 @@ repos:
|
|
|
7
7
|
- id: check-merge-conflict
|
|
8
8
|
- id: check-toml
|
|
9
9
|
- id: check-yaml
|
|
10
|
+
exclude: mkdocs.yml
|
|
10
11
|
- id: detect-private-key
|
|
11
12
|
- id: end-of-file-fixer
|
|
12
13
|
- id: fix-byte-order-marker
|
|
@@ -14,7 +15,7 @@ repos:
|
|
|
14
15
|
- id: trailing-whitespace
|
|
15
16
|
|
|
16
17
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
17
|
-
rev: "v0.16.
|
|
18
|
+
rev: "v0.16.6"
|
|
18
19
|
hooks:
|
|
19
20
|
- id: ruff-format
|
|
20
21
|
args: [--config=ruff.toml]
|
|
@@ -30,7 +31,7 @@ repos:
|
|
|
30
31
|
- prettier-plugin-toml@2.0.6
|
|
31
32
|
|
|
32
33
|
- repo: https://github.com/crate-ci/typos
|
|
33
|
-
rev: v1.
|
|
34
|
+
rev: v1.50.0
|
|
34
35
|
hooks:
|
|
35
36
|
- id: typos
|
|
36
37
|
exclude: |
|
cmd2-4.2.4/AGENTS.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Instructions for AI Agents
|
|
2
|
+
|
|
3
|
+
This file provides context and instructions for the agentic AI tools when working with this Python
|
|
4
|
+
project, which utilizes `uv` for environment and package management.
|
|
5
|
+
|
|
6
|
+
## General Instructions
|
|
7
|
+
|
|
8
|
+
- **Environment Management:** Prefer using `uv` for all Python environment management tasks.
|
|
9
|
+
- **Package Installation:** Always use `uv` to install packages and ensure they are installed within
|
|
10
|
+
the project's virtual environment.
|
|
11
|
+
- **Running Scripts/Commands:**
|
|
12
|
+
- To run Python scripts within the project's virtual environment, use `uv run ...`.
|
|
13
|
+
- To run programs directly from a PyPI package (installing it on the fly if necessary), use
|
|
14
|
+
`uvx ...` (shortcut for `uv tool run`).
|
|
15
|
+
- **New Dependencies:** If a new dependency is required, please state the reason for its inclusion.
|
|
16
|
+
- Do not commit spec, plan, or markdown documents to git without asking first.
|
|
17
|
+
- Save plans to `~/.superpowers/plans/` instead of the project directory.
|
|
18
|
+
|
|
19
|
+
## Python Code Standards
|
|
20
|
+
|
|
21
|
+
To ensure Python code adheres to required standards, the following commands **must** be run before
|
|
22
|
+
creating or modifying any `.py` files:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
make check
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
To run unit tests use the following command:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
make test
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
To make sure the documentation builds properly, use the following command:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
make docs-test
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
All 3 of the above commands should be run prior to committing code.
|
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
## 4.2.4 (September 8, 2026)
|
|
2
|
+
|
|
3
|
+
- Bug Fixes
|
|
4
|
+
- Fixed output redirection and piping raising `UnicodeEncodeError` and leaving an empty file
|
|
5
|
+
behind. Command output is rendered by Rich and contains box-drawing characters, which no
|
|
6
|
+
`cp125x` Windows ANSI code page can represent, so redirecting or piping it failed. This
|
|
7
|
+
affects current Windows 11 with default settings on Python 3.11 through 3.14, not only older
|
|
8
|
+
systems. Redirection targets and pipes now use UTF-8 explicitly
|
|
9
|
+
- Fixed the right prompt being redrawn beside every accepted command line in the scrollback.
|
|
10
|
+
prompt-toolkit includes it in the final frame of each prompt, which is the frame left on the
|
|
11
|
+
terminal; it is now hidden there, as the bottom toolbar already was, and stays on the live
|
|
12
|
+
prompt line only
|
|
13
|
+
|
|
14
|
+
## 4.2.3 (September 2, 2026)
|
|
15
|
+
|
|
16
|
+
- Bug Fixes
|
|
17
|
+
- Fix some links which were broken when published to PyPI
|
|
18
|
+
- Enhancements
|
|
19
|
+
- Converted `BoundCommandFunc` and `UnboundCommandFunc` TypeAliases in `types.py` to Protocol
|
|
20
|
+
classes for stricter type checking on `cmd2` command method references
|
|
21
|
+
|
|
1
22
|
## 4.2.2 (August 25, 2026)
|
|
2
23
|
|
|
3
24
|
- Documentation Improvements
|
cmd2-4.2.4/CLAUDE.md
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this
|
|
4
|
+
repository.
|
|
5
|
+
|
|
6
|
+
## Project
|
|
7
|
+
|
|
8
|
+
`cmd2` is a framework for building interactive command-line applications (REPLs) in Python. It
|
|
9
|
+
extends the stdlib `cmd` module and is built on **prompt-toolkit** (interactive input, key bindings,
|
|
10
|
+
completion, toolbars) and **Rich** / **rich-argparse** (all output rendering, help formatting,
|
|
11
|
+
theming). Requires Python >= 3.11. Environment/package management is **uv**.
|
|
12
|
+
|
|
13
|
+
## Commands
|
|
14
|
+
|
|
15
|
+
All work happens inside the uv-managed venv — run Python via `uv run ...`, and `uvx ...` for one-off
|
|
16
|
+
tools. Never `pip install`; if a new dependency is needed, state why before adding it.
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
make install # create the venv, install prek git hooks + prettier (one time)
|
|
20
|
+
make check # lock check + prek (ruff format/lint, prettier, typos) + ty + mypy
|
|
21
|
+
make test # pytest with coverage over tests/
|
|
22
|
+
make docs-test # verify the docs build cleanly (zensical)
|
|
23
|
+
make docs # build + serve docs with live reload
|
|
24
|
+
make help # list all targets
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
`make check`, `make test`, and `make docs-test` must all pass before committing. Run `make check`
|
|
28
|
+
before creating or modifying any `.py` file as well.
|
|
29
|
+
|
|
30
|
+
Narrower targets: `make format`, `make lint`, `make mypy`, `make ty`, `make typecheck`.
|
|
31
|
+
|
|
32
|
+
Running a single test or file (coverage flags come from `pyproject.toml` `addopts`, so pass
|
|
33
|
+
`--no-cov` when you just want a fast run):
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
uv run pytest tests/test_cmd2.py --no-cov
|
|
37
|
+
uv run pytest tests/test_cmd2.py::test_base_help -x --no-cov
|
|
38
|
+
uv run pytest -k "toolbar" --no-cov
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
On Windows-sensitive code, note `make test` runs pytest under `python -Xutf8`.
|
|
42
|
+
|
|
43
|
+
## Architecture
|
|
44
|
+
|
|
45
|
+
### Command dispatch
|
|
46
|
+
|
|
47
|
+
`cmd2/cmd2.py` (the `Cmd` class) is the core and by far the largest module. The flow for one line of
|
|
48
|
+
input is:
|
|
49
|
+
|
|
50
|
+
1. `cmdloop()` → `_cmdloop()` drives a prompt-toolkit `PromptSession` (created in
|
|
51
|
+
`_create_prompt_session`), not readline. Completion, history, lexing, and key bindings are all
|
|
52
|
+
supplied by prompt-toolkit adapters in `cmd2/pt_utils.py` (`Cmd2Completer`, `Cmd2History`,
|
|
53
|
+
`Cmd2Lexer`).
|
|
54
|
+
2. `onecmd_plus_hooks()` parses the line into a `Statement` (`cmd2/parsing.py` — handles shortcuts,
|
|
55
|
+
aliases, macros, terminators, multiline commands, redirection and pipe tokens), then runs the
|
|
56
|
+
plugin hook chain.
|
|
57
|
+
3. `_redirect_output()` swaps `self.stdout` for a file or subprocess pipe when the statement has
|
|
58
|
+
redirection, and restores it in the `finally` path.
|
|
59
|
+
4. `onecmd()` looks up and calls the `do_*` method.
|
|
60
|
+
|
|
61
|
+
Hooks (`cmd2/plugin.py` dataclasses, registered via `register_postparsing_hook`,
|
|
62
|
+
`register_precmd_hook`, `register_postcmd_hook`, `register_cmdfinalization_hook`,
|
|
63
|
+
`register_preloop_hook`, `register_postloop_hook`) are the supported extension points; the legacy
|
|
64
|
+
`precmd`/`postcmd` overrides still exist but are weaker.
|
|
65
|
+
|
|
66
|
+
### Argument parsing and completion
|
|
67
|
+
|
|
68
|
+
Three layers, all producing a `Cmd2ArgumentParser`:
|
|
69
|
+
|
|
70
|
+
- `cmd2/argparse_utils.py` — `Cmd2ArgumentParser` plus monkey-patching that extends argparse with
|
|
71
|
+
range `nargs` tuples, per-argument completion metadata, and subcommand records.
|
|
72
|
+
- `cmd2/decorators.py` — `@with_argparser`, `@with_argument_list`, `@with_category`,
|
|
73
|
+
`@as_subcommand_to` attach parsers/metadata to `do_*` methods.
|
|
74
|
+
- `cmd2/annotated.py` — the newer, still-experimental Typer-style path: `@with_annotated` builds a
|
|
75
|
+
parser from a function's type hints, with `Argument`/`Option` metadata via `typing.Annotated`.
|
|
76
|
+
|
|
77
|
+
Parsers are built lazily and cached by the `CommandParsers` class in `cmd2.py` (`_build_parser`), so
|
|
78
|
+
that `CommandSet`-supplied subcommands can be attached and detached at runtime.
|
|
79
|
+
`cmd2/argparse_completer.py` walks a parser to produce tab completions; completion results are
|
|
80
|
+
`Completions`/`CompletionItem` objects from `cmd2/completion.py`.
|
|
81
|
+
|
|
82
|
+
### Output and theming
|
|
83
|
+
|
|
84
|
+
Never print directly — go through `Cmd.print_to` / `poutput` / `perror` / `pwarning` / `pfeedback` /
|
|
85
|
+
`ppaged`, which route to Rich consoles defined in `cmd2/rich_utils.py` (`Cmd2GeneralConsole`,
|
|
86
|
+
`Cmd2RichArgparseConsole`, `Cmd2ExceptionConsole`). Styling flows one way: `cmd2/styles.py`
|
|
87
|
+
(style-name StrEnum + defaults) → `cmd2/theme.py` (single global theme, updated in-place for Rich
|
|
88
|
+
and exposed to prompt-toolkit through a `DynamicStyle`) → `cmd2/pt_utils.py` (`rich_to_pt_style`
|
|
89
|
+
converts Rich styles into prompt-toolkit ones). Adding a color or style means touching
|
|
90
|
+
`styles.py`/`colors.py`/`theme.py`, not hardcoding ANSI.
|
|
91
|
+
|
|
92
|
+
`cmd2/command_toolbar.py` and `cmd2/pager.py` are the trickiest parts of the codebase: they keep a
|
|
93
|
+
prompt-toolkit application alive _during_ synchronous command execution (bottom toolbar refresh,
|
|
94
|
+
paging) while stdout is proxied and redirection may be active. Changes there need care around
|
|
95
|
+
threads, signals, and Windows behavior.
|
|
96
|
+
|
|
97
|
+
### Modularity
|
|
98
|
+
|
|
99
|
+
`cmd2/command_set.py` (`CommandSet`) lets commands live in separate classes that are registered and
|
|
100
|
+
unregistered at runtime via `Cmd.register_command_set`; `cmd2/py_bridge.py` exposes the app to
|
|
101
|
+
embedded Python/IPython shells and `run_pyscript` while keeping isolation.
|
|
102
|
+
|
|
103
|
+
## Conventions
|
|
104
|
+
|
|
105
|
+
- Ruff is authoritative for format and lint (`ruff.toml`, line length 127, double quotes). Do not
|
|
106
|
+
suppress lint errors in code you write; broad ignores already exist for `examples/` and `tests/`.
|
|
107
|
+
- Both `mypy --strict` and `ty` must pass on the `cmd2` package. Full type annotations are required
|
|
108
|
+
on all library code (excluded: `tests/`, `examples/`, `docs/`).
|
|
109
|
+
- Docstrings are enforced by pydocstyle rules; public API items are documented in `docs/api/*.md`
|
|
110
|
+
and rendered by mkdocstrings, so keep docstrings accurate when changing signatures.
|
|
111
|
+
- Anything not documented under `docs/api/` is not public API (`cmd2/constants.py` says so
|
|
112
|
+
explicitly).
|
|
113
|
+
- Add user-visible changes to `CHANGELOG.md` under the current in-progress version heading.
|
|
114
|
+
- `main` is the branch for the next PATCH release; MAJOR/MINOR work happens on a branch named for
|
|
115
|
+
the target version. Releases are tagged and published from `main`.
|
|
116
|
+
- Do not commit spec, plan, or markdown documents without asking first. Save plans to
|
|
117
|
+
`~/.superpowers/plans/` rather than the project directory.
|
|
118
|
+
|
|
119
|
+
## Commit conventions
|
|
120
|
+
|
|
121
|
+
Never add "Co-Authored-By" lines to commits. Do not include Claude attribution in commit messages,
|
|
122
|
+
PR descriptions, or any git metadata. Do not include Claude session URL in commit messages, PR
|
|
123
|
+
descriptions, or any git metadata.
|
|
@@ -20,6 +20,8 @@ check: ## Run code quality tools.
|
|
|
20
20
|
@uv run prek run -a
|
|
21
21
|
@echo "🚀 Static type checking: Running ty"
|
|
22
22
|
@uv run ty check
|
|
23
|
+
@echo "🚀 Static type checking: Running mypy"
|
|
24
|
+
@uv run mypy .
|
|
23
25
|
|
|
24
26
|
.PHONY: format
|
|
25
27
|
format: ## Perform ruff formatting
|
|
@@ -29,8 +31,17 @@ format: ## Perform ruff formatting
|
|
|
29
31
|
lint: ## Perform ruff linting
|
|
30
32
|
@uv run ruff check --fix
|
|
31
33
|
|
|
34
|
+
.PHONY: mypy
|
|
35
|
+
mypy: ## Perform type checking using mypy
|
|
36
|
+
@uv run mypy .
|
|
37
|
+
|
|
38
|
+
.PHONY: ty
|
|
39
|
+
ty: ## Perform type checking using ty
|
|
40
|
+
@uv run ty check
|
|
41
|
+
|
|
32
42
|
.PHONY: typecheck
|
|
33
|
-
typecheck: ## Perform type checking
|
|
43
|
+
typecheck: ## Perform type checking using both mypy and ty
|
|
44
|
+
@uv run mypy .
|
|
34
45
|
@uv run ty check
|
|
35
46
|
|
|
36
47
|
.PHONY: test
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cmd2
|
|
3
|
-
Version: 4.2.
|
|
3
|
+
Version: 4.2.4
|
|
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
|
|
@@ -27,7 +27,7 @@ Requires-Dist: rich>=15.0.0
|
|
|
27
27
|
Requires-Dist: rich-argparse>=1.7.2
|
|
28
28
|
Dynamic: license-file
|
|
29
29
|
|
|
30
|
-
<h1 align="center">cmd2
|
|
30
|
+
<h1 align="center">cmd2: build feature-rich command-line applications in Python</h1>
|
|
31
31
|
|
|
32
32
|
[](https://pypi.python.org/pypi/cmd2/)
|
|
33
33
|
[](https://github.com/python-cmd2/cmd2/actions/workflows/tests.yml)
|
|
@@ -36,77 +36,145 @@ Dynamic: license-file
|
|
|
36
36
|
<a href="https://discord.gg/RpVG6tk"><img src="https://img.shields.io/badge/chat-on%20discord-7289da.svg" alt="Chat"></a>
|
|
37
37
|
|
|
38
38
|
<p align="center">
|
|
39
|
-
<a href="#
|
|
40
|
-
<a href="#
|
|
39
|
+
<a href="#quick-start">Quick start</a> •
|
|
40
|
+
<a href="#why-cmd2">Why cmd2?</a> •
|
|
41
41
|
<a href="#installation">Installation</a> •
|
|
42
42
|
<a href="#documentation">Documentation</a> •
|
|
43
|
-
<a href="#
|
|
44
|
-
<a href="#hello-world">Hello World</a> •
|
|
45
|
-
<a href="#projects-using-cmd2">Projects using cmd2</a> •
|
|
43
|
+
<a href="#projects-using-cmd2">Projects using cmd2</a>
|
|
46
44
|
</p>
|
|
47
45
|
|
|
48
|
-
|
|
46
|
+
`cmd2` makes it quick to build powerful, polished command-line applications and REPLs in Python.
|
|
47
|
+
Start with a subclass of the standard library's
|
|
48
|
+
[`cmd.Cmd`](https://docs.python.org/3/library/cmd.html), then add commands while `cmd2` handles the
|
|
49
|
+
details that make an application pleasant to build and use: argument parsing, generated help, tab
|
|
50
|
+
completion, command history, scripting, output styling, and much more.
|
|
49
51
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
applications. It provides a simple API which is an extension of Python's built-in
|
|
53
|
-
[cmd](https://docs.python.org/3/library/cmd.html) module. cmd2 provides a wealth of features on top
|
|
54
|
-
of cmd to make your life easier and eliminates much of the boilerplate code which would be necessary
|
|
55
|
-
when using cmd.
|
|
52
|
+
You can use `cmd2` for a small internal tool and grow the same application into an extensible,
|
|
53
|
+
scriptable interface without replacing the framework or writing the usual CLI boilerplate.
|
|
56
54
|
|
|
57
|
-
|
|
58
|
-
> significant backwards incompatibilities from previous versions. Please see the
|
|
59
|
-
> [CHANGELOG](./CHANGELOG.md) for info on what has changed and the
|
|
60
|
-
> [Migration Guide](https://cmd2.readthedocs.io/en/latest/upgrades/) for tips on upgrading from an
|
|
61
|
-
> older version of `cmd2` to `4.x`**
|
|
55
|
+
## Quick start
|
|
62
56
|
|
|
63
|
-
|
|
57
|
+
Install `cmd2`:
|
|
64
58
|
|
|
65
|
-
|
|
59
|
+
```bash
|
|
60
|
+
pip install cmd2
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Then create `app.py`:
|
|
64
|
+
|
|
65
|
+
```python
|
|
66
|
+
from typing import Annotated
|
|
67
|
+
|
|
68
|
+
import cmd2
|
|
69
|
+
from cmd2.annotated import Argument, Option
|
|
66
70
|
|
|
67
|
-
When creating solutions developers have no shortage of tools to create rich and smart user
|
|
68
|
-
interfaces. System administrators have long been duct taping together brittle workflows based on a
|
|
69
|
-
menagerie of simple command line tools created by strangers on github and the guy down the hall.
|
|
70
|
-
Unfortunately, when CLIs become significantly complex the ease of command discoverability tends to
|
|
71
|
-
fade quickly. On the other hand, Web and traditional desktop GUIs are first in class when it comes
|
|
72
|
-
to easily discovering functionality. The price we pay for beautifully colored displays is complexity
|
|
73
|
-
required to aggregate disparate applications into larger systems. `cmd2` fills the niche between
|
|
74
|
-
high [ease of command discovery](https://clig.dev/#ease-of-discovery) applications and smart
|
|
75
|
-
workflow automation systems.
|
|
76
71
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
extensive tab completion. When users become comfortable with functionality, cmd2 turns into a
|
|
80
|
-
feature rich library enabling a smooth transition to full automation. If designed with enough
|
|
81
|
-
forethought, a well implemented cmd2 application can serve as a boutique workflow tool. `cmd2` pulls
|
|
82
|
-
off this flexibility based on two pillars of philosophy:
|
|
72
|
+
class App(cmd2.Cmd):
|
|
73
|
+
"""A small interactive application."""
|
|
83
74
|
|
|
84
|
-
|
|
85
|
-
|
|
75
|
+
@cmd2.with_annotated
|
|
76
|
+
def do_greet(
|
|
77
|
+
self,
|
|
78
|
+
name: Annotated[str, Argument(help_text="person to greet")],
|
|
79
|
+
count: Annotated[int, Option(help_text="number of greetings")] = 1,
|
|
80
|
+
) -> None:
|
|
81
|
+
"""Greet a person."""
|
|
82
|
+
for _ in range(count):
|
|
83
|
+
self.poutput(f"Hello, {name}!")
|
|
86
84
|
|
|
87
|
-
## Philosophy
|
|
88
85
|
|
|
89
|
-
|
|
86
|
+
if __name__ == "__main__":
|
|
87
|
+
App().cmdloop()
|
|
88
|
+
```
|
|
90
89
|
|
|
91
|
-
|
|
92
|
-
|
|
90
|
+
`cmd2` supports [Typer](https://typer.tiangolo.com/)-style syntax for specifying command arguments
|
|
91
|
+
with type annotations. In this example, `@cmd2.with_annotated` turns `name` and `count` into a
|
|
92
|
+
positional argument and an option.
|
|
93
93
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
- Automatic tab completion of `argparse` flags and optional arguments.
|
|
98
|
-
- Path completion easily enabled.
|
|
99
|
-
- When all else fails, custom tab completion based on `choices_provider` can fill any gaps.
|
|
94
|
+
Run it with `python app.py`. Your new `greet` command already has input validation, generated help,
|
|
95
|
+
and tab completion for its options. The application also includes discoverable help, command
|
|
96
|
+
history, aliases, macros, scripting, shell integration, and other built-in commands.
|
|
100
97
|
|
|
101
|
-
|
|
98
|
+
```console
|
|
99
|
+
(Cmd) help greet
|
|
100
|
+
Usage: greet [-h] [--count COUNT] name
|
|
102
101
|
|
|
103
|
-
|
|
104
|
-
|
|
102
|
+
(Cmd) greet --count 2 Ada
|
|
103
|
+
Hello, Ada!
|
|
104
|
+
Hello, Ada!
|
|
105
|
+
```
|
|
105
106
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
107
|
+
[](https://raw.githubusercontent.com/python-cmd2/cmd2/main/docs/assets/cmd2-readme-demo.gif)
|
|
108
|
+
|
|
109
|
+
See the [getting started tutorial](https://cmd2.readthedocs.io/en/latest/examples/getting_started/)
|
|
110
|
+
to build a more complete application.
|
|
111
|
+
|
|
112
|
+
## Why cmd2?
|
|
113
|
+
|
|
114
|
+
### Build more with less code
|
|
115
|
+
|
|
116
|
+
- Define commands as Python methods and use familiar
|
|
117
|
+
[`argparse`](https://cmd2.readthedocs.io/en/latest/features/argument_processing/) parsers for
|
|
118
|
+
arguments and subcommands. A single parser definition drives validation, help, and completion.
|
|
119
|
+
- Render Rich tables and other styled objects, with consistent helpers for
|
|
120
|
+
[normal output, errors, warnings, and paging](https://cmd2.readthedocs.io/en/latest/features/generating_output/).
|
|
121
|
+
- Organize large applications into independently testable and dynamically loadable
|
|
122
|
+
[CommandSets](https://cmd2.readthedocs.io/en/latest/features/modular_commands/), and customize the
|
|
123
|
+
command lifecycle with [hooks](https://cmd2.readthedocs.io/en/latest/features/hooks/).
|
|
124
|
+
- Integrate existing Python code, shell tools, or asynchronous work instead of restructuring your
|
|
125
|
+
application around the framework.
|
|
126
|
+
- Run on Windows, macOS, and Linux with a pure-Python package and a small dependency footprint.
|
|
127
|
+
|
|
128
|
+
### Give users a capable interface from day one
|
|
129
|
+
|
|
130
|
+
- **Tab completion:** provide context-aware completion for commands, subcommands, options, choices,
|
|
131
|
+
file paths, and custom data sources, with descriptive hints for completion candidates. Learn more
|
|
132
|
+
about [completion](https://cmd2.readthedocs.io/en/latest/features/completion/).
|
|
133
|
+
- **History:** search, edit, rerun, save, and optionally persist previously entered commands. Users
|
|
134
|
+
also get familiar navigation and reverse search such as <kbd>Ctrl</kbd>+<kbd>R</kbd>. Learn more
|
|
135
|
+
about [history](https://cmd2.readthedocs.io/en/latest/features/history/).
|
|
136
|
+
- **Unicode:** accept Unicode in commands, arguments, file names, and output, and run UTF-8 command
|
|
137
|
+
scripts for applications used in any language. Learn more about
|
|
138
|
+
[command scripts](https://cmd2.readthedocs.io/en/latest/features/scripting/#command-scripts).
|
|
139
|
+
- **Shell shortcuts and hotkeys:** use familiar Readline-style keyboard shortcuts for navigating and
|
|
140
|
+
editing the command line, including Emacs-style bindings provided by `prompt-toolkit`. Learn more
|
|
141
|
+
about [keyboard shortcuts](https://cmd2.readthedocs.io/en/latest/features/history/#for-users).
|
|
142
|
+
- **Help:** generate discoverable, categorized help for commands, subcommands, and arguments
|
|
143
|
+
directly from their argument parsers. Learn more about
|
|
144
|
+
[help](https://cmd2.readthedocs.io/en/latest/features/help/).
|
|
145
|
+
- **Rich UI/UX:** offer syntax highlighting, Fish-style history suggestions, multiline input,
|
|
146
|
+
configurable prompts, completion menus, themes, and an optional bottom toolbar. Learn more about
|
|
147
|
+
[prompts and toolbars](https://cmd2.readthedocs.io/en/latest/features/prompt/) and
|
|
148
|
+
[themes](https://cmd2.readthedocs.io/en/latest/features/theme/).
|
|
149
|
+
|
|
150
|
+
### Grow from exploration to automation
|
|
151
|
+
|
|
152
|
+
- **Shell scripting:** automate the same commands users run interactively by passing them as command
|
|
153
|
+
arguments or standard input from shell scripts. Learn more about
|
|
154
|
+
[automating cmd2 applications](https://cmd2.readthedocs.io/en/latest/features/os/#automating-cmd2-apps-from-other-cliclu-tools).
|
|
155
|
+
- **Python scripting:** run Python scripts inside the application for loops, branching, complex
|
|
156
|
+
control flow, and integration with the application's commands and data. Learn more about
|
|
157
|
+
[Python scripts](https://cmd2.readthedocs.io/en/latest/features/scripting/#python-scripts).
|
|
158
|
+
- **Run shell commands:** execute operating-system commands without leaving the application, using
|
|
159
|
+
the built-in `shell` command or its `!` shortcut. Learn more about
|
|
160
|
+
[OS integration](https://cmd2.readthedocs.io/en/latest/features/os/#executing-os-commands-from-within-cmd2).
|
|
161
|
+
- **Redirect output:** send command output to files or the clipboard, or pipe it through one or more
|
|
162
|
+
shell commands. Learn more about
|
|
163
|
+
[output redirection and pipes](https://cmd2.readthedocs.io/en/latest/features/redirection/).
|
|
164
|
+
- **Aliases, macros, and shortcuts:** let users customize names, parameterized commands, and terse
|
|
165
|
+
shortcuts for repetitive workflows without changing the application. Learn more about
|
|
166
|
+
[aliases, macros, and shortcuts](https://cmd2.readthedocs.io/en/latest/features/shortcuts_aliases_macros/).
|
|
167
|
+
- **Startup scripts:** initialize an application consistently by running saved commands every time
|
|
168
|
+
it starts. Learn more about
|
|
169
|
+
[startup commands and scripts](https://cmd2.readthedocs.io/en/latest/features/startup_commands/).
|
|
170
|
+
- **Embedded Python and IPython shells:** drop into an interactive Python or IPython session for
|
|
171
|
+
experimentation, debugging, object introspection, and access to application state. Learn more
|
|
172
|
+
about
|
|
173
|
+
[embedded Python shells](https://cmd2.readthedocs.io/en/latest/features/embedded_python_shells/).
|
|
174
|
+
- **Color, style, and tables:** produce readable output with Rich colors and styles, custom themes,
|
|
175
|
+
paging, and flexible table layouts. Learn more about
|
|
176
|
+
[generating output](https://cmd2.readthedocs.io/en/latest/features/generating_output/) and
|
|
177
|
+
[creating tables](https://cmd2.readthedocs.io/en/latest/features/table_creation/).
|
|
110
178
|
|
|
111
179
|
## Installation
|
|
112
180
|
|
|
@@ -120,17 +188,21 @@ cmd2 works with Python 3.11+ on Windows, macOS, and Linux. It is pure Python cod
|
|
|
120
188
|
dependencies. It works with both conventional CPython and free-threaded variants.
|
|
121
189
|
|
|
122
190
|
For information on other installation options, see
|
|
123
|
-
[Installation Instructions](https://cmd2.readthedocs.io/en/latest/overview/installation
|
|
191
|
+
[Installation Instructions](https://cmd2.readthedocs.io/en/latest/overview/installation/) in the
|
|
124
192
|
cmd2 documentation.
|
|
125
193
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
194
|
+
<!-- prettier-ignore -->
|
|
195
|
+
> [!IMPORTANT]
|
|
196
|
+
> Upgrading from an older release? Versions 3.x and 4.x include significant
|
|
197
|
+
> backwards-incompatible changes. Review the [changelog](https://github.com/python-cmd2/cmd2/blob/main/CHANGELOG.md)
|
|
198
|
+
> and [migration guide](https://cmd2.readthedocs.io/en/latest/upgrades/) before upgrading.
|
|
129
199
|
|
|
130
|
-
|
|
200
|
+
## Documentation
|
|
131
201
|
|
|
132
|
-
|
|
133
|
-
|
|
202
|
+
Read the [latest documentation](https://cmd2.readthedocs.io/en/latest/) online or download it in
|
|
203
|
+
HTML, PDF, and ePub formats. The
|
|
204
|
+
[`examples`](https://github.com/python-cmd2/cmd2/tree/main/examples) directory contains focused,
|
|
205
|
+
runnable demonstrations of individual features.
|
|
134
206
|
|
|
135
207
|
## Tutorials
|
|
136
208
|
|
|
@@ -145,29 +217,6 @@ examples.
|
|
|
145
217
|
- Advanced cookiecutter template with external plugin support :
|
|
146
218
|
https://github.com/jayrod/cookiecutter-python-cmd2-ext-plug
|
|
147
219
|
|
|
148
|
-
## Hello World
|
|
149
|
-
|
|
150
|
-
```python
|
|
151
|
-
#!/usr/bin/env python
|
|
152
|
-
"""A simple cmd2 application."""
|
|
153
|
-
import cmd2
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
class FirstApp(cmd2.Cmd):
|
|
157
|
-
"""A simple cmd2 application."""
|
|
158
|
-
|
|
159
|
-
def do_hello_world(self, _: cmd2.Statement):
|
|
160
|
-
self.poutput('Hello World')
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
if __name__ == '__main__':
|
|
164
|
-
import sys
|
|
165
|
-
|
|
166
|
-
c = FirstApp()
|
|
167
|
-
sys.exit(c.cmdloop())
|
|
168
|
-
|
|
169
|
-
```
|
|
170
|
-
|
|
171
220
|
## Found a bug?
|
|
172
221
|
|
|
173
222
|
If you think you've found a bug, please first read through the open
|
|
@@ -202,6 +251,7 @@ reproduce the bug. At a minimum, please state the following:
|
|
|
202
251
|
| [Falcon Toolkit](https://github.com/CrowdStrike/Falcon-Toolkit) | Unleash the power of the CrowdStrike Falcon Platform at the CLI | [CrowdStrike](https://github.com/CrowdStrike) |
|
|
203
252
|
| [EXPLIoT](https://gitlab.com/expliot_framework/expliot) | Internet of Things Security Testing and Exploitation framework | [expliot_framework](https://gitlab.com/expliot_framework/) |
|
|
204
253
|
| [Pobshell](https://github.com/pdalloz/pobshell) | A Bash‑like shell for live Python objects: `cd`, `ls`, `cat`, `find` and _CLI piping_ for object code, str values & more | [Peter Dalloz](https://www.linkedin.com/in/pdalloz) |
|
|
254
|
+
| [Wtsh](https://gitee.com/wazzge/wtsh) | WTSH is a shell built with Python cmd2(v4), which uses third-party plugins to construct a universal shell installed via Pip | [wazzge](https://gitee.com/wazzge) |
|
|
205
255
|
|
|
206
256
|
Possibly defunct but still good examples
|
|
207
257
|
|