What should show in cmd2 history?
See original GitHub issue@kotfu @tleonhardt This question pertains to cmd2’s history and not readline’s.
Currently we put what the user typed in history. (statement.raw) Is there any reason why can’t put what was run instead? (statement.command_and_args)
That would make it clearer when things like shortcuts and aliases are entered. You will have a record of what actually occurred.
Issue Analytics
- State:
- Created 5 years ago
- Comments:21 (21 by maintainers)
Top Results From Across the Web
History — cmd2 2.4 documentation - Read the Docs
The cmd module from the Python standard library includes readline history. ... For example, if you give -1 it will display the last...
Read more >cmd2 Documentation - Read the Docs
cmd2 tracks the history of the commands that users enter. As a developer, you don't need to do anything to enable.
Read more >cmd2 · PyPI
Feature Overview · By design, this history does NOT persist between application runs · If you wish to exclude some of your custom...
Read more >Bash command completion with full path expansion injected ...
pushd ~/bin/x/y/cmd1.sh pushd ~/bin/a/b/cmd2.sh pushd /ppp/n/m/cmd3.sh pushd ~ ... The solutions that I will show will offer up basenames of ...
Read more >Key Sequence Broadcaster History - Support - Royal Apps
Can we implement a feature so key sequence broadcaster shows a history of previous last ... I'm not sure how a history could...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I like all of this. One suggestion: lets add a deep copy of the Statement object to the HistoryItem instead of raw, command and args, etc. That way we are sure to have everything we might ever need, and can continue to encapsulate any code to split/join parts of the statement into that class.
@lancestarr I like the idea of
history -vonly showing both if they are different.For transcript output, it actually re-runs the commands and generates a transcript for regression testing. I know this feature is a little confusing, but it is actually used by end users for their testing purposes. Generating a transcript in this fashion is typically much easier than doing it by hand. Perhaps we could clarify the help text for the
-tflag to make it more clear. And yes, people really care about transcript output - I’m aware of one end user who no longer writes unit tests and writes transcript tests instead.The Transcript based testing section of the
cmd2docs contains more info.