cmd2
cmd2 copied to clipboard
Persist failed commands for history
Hello team,
Cool project! for the history part, it's working well, except when it's an "unrecognized" command, it would be nice to log/persist the history of those failed commands, or add a param to accept it.
[BlackB0x test]# python persistent_history.py
ph>
ph> intentional typ0
intentional is not a recognized command, alias, or macro
ph> intentional typo
intentional is not a recognized command, alias, or macro
ph> history
ph> quit
[BlackB0x test]# python persistent_history.py
ph> history -a
1 help
2 shell ls
3 shell whoami
4 quit
5 shell pwd
6 quit
7 quit
ph>
@ZakCheb This is an interesting idea for a feature request.
At first glance to me, it feels like an anti-pattern. I don't want to help users type the wrong thing ;-)
But perhaps if it were optional it might be ok.
So, looking back at bash for inspiration, bash does seem to preserve everything the user has submitted regardless of whether it was a valid command.
While cmd2 does broadly take bash as an inspiration, we value customer/user experience more than strict adherence to behaving like any particular shell program.
I think it is more important to make it easy for users to use an application correctly and difficult to use it incorrectly. Storing commands known to fail in the history seems like a way to make it easy for users to use an application incorrectly. As such, I am going to close this issue.
If any of the cmd2 core developers strongly disagree, feel free to re-open.