Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ cmd2/rich_utils.py @kmvanbrunt
cmd2/string_utils.py @kmvanbrunt
cmd2/styles.py @tleonhardt @kmvanbrunt
cmd2/terminal_utils.py @kmvanbrunt
cmd2/transcript.py @tleonhardt
cmd2/utils.py @tleonhardt @kmvanbrunt

# Documentation
Expand Down
2 changes: 0 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ repos:
- id: check-merge-conflict
- id: check-toml
- id: end-of-file-fixer
exclude: ^examples/transcripts/
- id: trailing-whitespace
exclude: ^examples/transcripts/

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.15.2"
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ prompt is displayed.
each platform and provided utility functions related to `readline`
- Added a dependency on `prompt-toolkit` and a new `cmd2.pt_utils` module with supporting
utilities
- Removed **Transcript Testing** feature set along with the `history -t` option for generating
transcript files and the `cmd2.transcript` module
- This was an extremely brittle regression testing framework which should never have been
built into cmd2
- We recommend using [pytest](https://docs.pytest.org/) for unit and integration tests and
[Robot Framework](https://robotframework.org/) for acceptance tests. Both of these
frameworks can be used to create tests which are far more reliable and less brittle.
- Async specific: `prompt-toolkit` starts its own `asyncio` event loop in every `cmd2`
application
- Removed `cmd2.Cmd.terminal_lock` as it is no longer required to support things like
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ command line argument parsing and execution of cmd2 scripting.
- Text file scripting of your application with `run_script` (`@`) and `_relative_run_script` (`@@`)
- Powerful and flexible built-in Python scripting of your application using the `run_pyscript`
command
- Transcripts for use with built-in regression can be automatically generated from `history -t` or
`run_script -t`

## Installation

Expand Down
263 changes: 23 additions & 240 deletions cmd2/cmd2.py

Large diffs are not rendered by default.

223 changes: 0 additions & 223 deletions cmd2/transcript.py

This file was deleted.

1 change: 0 additions & 1 deletion docs/api/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,4 @@ incremented according to the [Semantic Version Specification](https://semver.org
- [cmd2.string_utils](./string_utils.md) - string utility functions
- [cmd2.styles](./styles.md) - cmd2-specific Rich styles and a StrEnum of their corresponding names
- [cmd2.terminal_utils](./terminal_utils.md) - support for terminal control escape sequences
- [cmd2.transcript](./transcript.md) - functions and classes for running and validating transcripts
- [cmd2.utils](./utils.md) - various utility classes and functions
3 changes: 0 additions & 3 deletions docs/api/transcript.md

This file was deleted.

1 change: 0 additions & 1 deletion docs/examples/alternate_event_loops.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,4 @@ integrate with any specific event loop is beyond the scope of this documentation
running in this fashion comes with several disadvantages, including:

- Requires the developer to write more code
- Does not support transcript testing
- Does not allow commands at invocation via command-line arguments
1 change: 0 additions & 1 deletion docs/examples/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ The last thing you'll notice is that we used the `self.poutput()` method to disp

1. Allows the user to redirect output to a text file or pipe it to a shell process
1. Gracefully handles `BrokenPipeError` exceptions for redirected output
1. Makes the output show up in a [transcript](../features/transcripts.md)
1. Honors the setting to [strip embedded ANSI sequences](../features/settings.md#allow_style)
(typically used for background and foreground colors)

Expand Down
24 changes: 5 additions & 19 deletions docs/features/history.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,20 +167,6 @@ text file:

(Cmd) history :5 -o history.txt

The `history` command can also save both the commands and their output to a text file. This is
called a transcript. See [Transcripts](./transcripts.md) for more information on how transcripts
work, and what you can use them for. To create a transcript use the `-t` or `--transcription`
option:

(Cmd) history 2:3 --transcript transcript.txt

The `--transcript` option implies `--run`: the commands must be re-run in order to capture their
output to the transcript file.

!!! warning

Unlike the `-o`/`--output-file` option, the `-t`/`--transcript` option will actually run the selected history commands again. This is necessary for creating a transcript file since the history saves the commands themselves but does not save their output. Please note that a side-effect of this is that the commands will appear again at the end of the history.

The last action the history command can perform is to clear the command history using `-c` or
`--clear`:

Expand All @@ -189,11 +175,11 @@ The last action the history command can perform is to clear the command history
In addition to these five actions, the `history` command also has some options to control how the
output is formatted. With no arguments, the `history` command displays the command number before
each command. This is great when displaying history to the screen because it gives you an easy
reference to identify previously entered commands. However, when creating a script or a transcript,
the command numbers would prevent the script from loading properly. The `-s` or `--script` option
instructs the `history` command to suppress the line numbers. This option is automatically set by
the `--output-file`, `--transcript`, and `--edit` options. If you want to output the history
commands with line numbers to a file, you can do it with output redirection:
reference to identify previously entered commands. However, when creating a script, the command
numbers would prevent the script from loading properly. The `-s` or `--script` option instructs the
`history` command to suppress the line numbers. This option is automatically set by the
`--output-file` and `--edit` options. If you want to output the history commands with line numbers
to a file, you can do it with output redirection:

(Cmd) history 1:4 > history.txt

Expand Down
1 change: 0 additions & 1 deletion docs/features/hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ loop behavior:

- `allow_cli_args` - allows commands to be specified on the operating system command line which are
executed before the command processing loop begins
- `transcript_files` - see [Transcripts](./transcripts.md) for more information
- `startup_script` - run a script on initialization. See [Scripting](./scripting.md) for more
information

Expand Down
1 change: 0 additions & 1 deletion docs/features/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,5 @@
- [Startup Commands](startup_commands.md)
- [Table Creation](table_creation.md)
- [Theme](theme.md)
- [Transcripts](transcripts.md)
<!--intro-end-->
</div>
16 changes: 8 additions & 8 deletions docs/features/os.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,23 +77,23 @@ user to enter commands, which are then executed by your program.
You may want to execute commands in your program without prompting the user for any input. There are
several ways you might accomplish this task. The easiest one is to pipe commands and their arguments
into your program via standard input. You don't need to do anything to your program in order to use
this technique. Here's a demonstration using the `examples/transcript_example.py` included in the
this technique. Here's a demonstration using the `examples/cmd_as_argument.py` included in the
source code of `cmd2`:

$ echo "speak -p some words" | python examples/transcript_example.py
$ echo "speak -p some words" | python examples/cmd_as_argument.py
omesay ordsway

Using this same approach you could create a text file containing the commands you would like to run,
one command per line in the file. Say your file was called `somecmds.txt`. To run the commands in
the text file using your `cmd2` program (from a Windows command prompt):

c:\cmd2> type somecmds.txt | python.exe examples/transcript_example.py
c:\cmd2> type somecmds.txt | python.exe examples/cmd_as_argument.py
omesay ordsway

By default, `cmd2` programs also look for commands passed as arguments from the operating system
shell, and execute those commands before entering the command loop:

$ python examples/transcript_example.py help
$ python examples/cmd_as_argument.py help

Documented Commands
───────────────────
Expand All @@ -107,8 +107,8 @@ example, you might have a command inside your `cmd2` program which itself accept
maybe even option strings. Say you wanted to run the `speak` command from the operating system
shell, but have it say it in pig latin:

$ python examples/transcript_example.py speak -p hello there
python transcript_example.py speak -p hello there
$ python examples/cmd_as_argument.py speak -p hello there
python cmd_as_argument.py speak -p hello there
usage: speak [-h] [-p] [-s] [-r REPEAT] words [words ...]
speak: error: the following arguments are required: words
*** Unknown syntax: -p
Expand All @@ -131,7 +131,7 @@ Check the source code of this example, especially the `main()` function, to see
Alternatively you can simply wrap the command plus arguments in quotes (either single or double
quotes):

$ python examples/transcript_example.py "speak -p hello there"
$ python examples/cmd_as_argument.py "speak -p hello there"
ellohay heretay
(Cmd)

Expand All @@ -157,6 +157,6 @@ quits while returning an exit code:

Here is another example using `quit`:

$ python examples/transcript_example.py "speak -p hello there" quit
$ python examples/cmd_as_argument.py "speak -p hello there" quit
ellohay heretay
$
Loading
Loading