cmd2
cmd2 copied to clipboard
Allow scripts to bypass adding their commands to the history
At least in most of my use cases, the individual commands of a script executed by the command line should not end up in the history. If I go back in history, I want to find the commands I typed (like the run_script), and not the commands contained in the script I executed, or even the scripts that this script might execute itself. Imagine this happening on your bash/tcsh/zsh: Every time you execute a shell script your history is cluttered.
I took care to preserve the existing behavior by default in these patches. However, if the cmd2 maintainers agree, it would of course also make sense (from my point of view) to simply never add the commands form scripts to the history and avoid all the configurability this patch introuces for backwards compatibility. Or introduce this patch, and change the default to "don't add to history".
Also, the naming of the settable and the run_script argument could possibly be improved, I just didn't come up with somtehing better so far.
Codecov Report
Attention: 1 lines in your changes are missing coverage. Please review.
Comparison is base (
be15939) 98.56% compared to head (efd3eb0) 94.62%.
| Files | Patch % | Lines |
|---|---|---|
| cmd2/cmd2.py | 90.00% | 1 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## master #1291 +/- ##
==========================================
- Coverage 98.56% 94.62% -3.94%
==========================================
Files 22 22
Lines 5780 5786 +6
==========================================
- Hits 5697 5475 -222
- Misses 83 311 +228
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.