Silence escape code output from hishtory (#260)

* Silence escape code output from hishtory

* Update goldens

* Add support for full-screen rendering (#258)

* Release v0.314

* Disable tmate

* Delete double new lines

* Update test
This commit is contained in:
David Dworken 2024-10-20 14:06:54 -07:00 committed by GitHub
parent 0023c72636
commit 3e6a4c8e5b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 18 additions and 13 deletions

View File

@ -2732,7 +2732,8 @@ echo baz`)
// And then uninstall // And then uninstall
out, err := tester.RunInteractiveShellRelaxed(t, `yes | hishtory uninstall`) out, err := tester.RunInteractiveShellRelaxed(t, `yes | hishtory uninstall`)
require.NoError(t, err) require.NoError(t, err)
testutils.CompareGoldens(t, out, "testUninstall-uninstall") out = strings.Replace(out, "/Users/", "/home/", -1)
testutils.CompareGoldens(t, out, "testUninstall-uninstall-"+tester.ShellName())
// And check that hishtory has been uninstalled // And check that hishtory has been uninstalled
out, err = tester.RunInteractiveShellRelaxed(t, `echo foo out, err = tester.RunInteractiveShellRelaxed(t, `echo foo

View File

@ -6,8 +6,8 @@ function _hishtory_post_exec --on-event fish_preexec
# Runs after <ENTER>, but before the command is executed # Runs after <ENTER>, but before the command is executed
set --global _hishtory_command $argv set --global _hishtory_command $argv
set --global _hishtory_start_time (hishtory getTimestamp) set --global _hishtory_start_time (hishtory getTimestamp)
hishtory presaveHistoryEntry fish "$_hishtory_command" $_hishtory_start_time &; disown # Background Run hishtory presaveHistoryEntry fish "$_hishtory_command" $_hishtory_start_time &; disown 2>&1 >/dev/null # Background Run
# hishtory presaveHistoryEntry fish "$_hishtory_command" $_hishtory_start_time # Foreground Run # hishtory presaveHistoryEntry fish "$_hishtory_command" $_hishtory_start_time 2>&1 >/dev/null # Foreground Run
end end
set --global _hishtory_first_prompt 1 set --global _hishtory_first_prompt 1
@ -19,8 +19,8 @@ function __hishtory_on_prompt --on-event fish_prompt
if [ -n "$_hishtory_first_prompt" ] if [ -n "$_hishtory_first_prompt" ]
set --global -e _hishtory_first_prompt set --global -e _hishtory_first_prompt
else if [ -n "$_hishtory_command" ] else if [ -n "$_hishtory_command" ]
hishtory saveHistoryEntry fish $_hishtory_exit_code "$_hishtory_command" $_hishtory_start_time &; disown # Background Run hishtory saveHistoryEntry fish $_hishtory_exit_code "$_hishtory_command" $_hishtory_start_time &; disown 2>&1 >/dev/null # Background Run
# hishtory saveHistoryEntry fish $_hishtory_exit_code "$_hishtory_command" $_hishtory_start_time # Foreground Run # hishtory saveHistoryEntry fish $_hishtory_exit_code "$_hishtory_command" $_hishtory_start_time 2>&1 >/dev/null # Foreground Run
hishtory updateLocalDbFromRemote &; disown hishtory updateLocalDbFromRemote &; disown
set --global -e _hishtory_command # Unset _hishtory_command so we don't double-save entries when fish_prompt is invoked but fish_postexec isn't set --global -e _hishtory_command # Unset _hishtory_command so we don't double-save entries when fish_prompt is invoked but fish_postexec isn't
end end

View File

@ -31,8 +31,8 @@ function __hishtory_precommand() {
# such that it is worth accepting this issue to mitigate the duplicate entries observed in # such that it is worth accepting this issue to mitigate the duplicate entries observed in
# https://github.com/ddworken/hishtory/issues/215. # https://github.com/ddworken/hishtory/issues/215.
if [[ "$CMD" != "$LAST_PRESAVED_COMMAND" ]] && [[ "$CMD" != "$LAST_SAVED_COMMAND" ]]; then if [[ "$CMD" != "$LAST_PRESAVED_COMMAND" ]] && [[ "$CMD" != "$LAST_SAVED_COMMAND" ]]; then
(hishtory presaveHistoryEntry bash "$CMD" $HISHTORY_START_TIME &) # Background Run (hishtory presaveHistoryEntry bash "$CMD" $HISHTORY_START_TIME &) 2>&1 >/dev/null # Background Run
# hishtory presaveHistoryEntry bash "$CMD" $HISHTORY_START_TIME # Foreground Run # hishtory presaveHistoryEntry bash "$CMD" $HISHTORY_START_TIME 2>&1 >/dev/null # Foreground Run
fi fi
fi fi
LAST_PRESAVED_COMMAND=$CMD LAST_PRESAVED_COMMAND=$CMD
@ -51,8 +51,8 @@ function __hishtory_postcommand() {
# Run after every prompt # Run after every prompt
CMD=`history 1` CMD=`history 1`
(hishtory saveHistoryEntry bash $EXIT_CODE "$CMD" $HISHTORY_START_TIME &) # Background Run (hishtory saveHistoryEntry bash $EXIT_CODE "$CMD" $HISHTORY_START_TIME &) 2>&1 >/dev/null # Background Run
# hishtory saveHistoryEntry bash $EXIT_CODE "$CMD" $HISHTORY_START_TIME # Foreground Run # hishtory saveHistoryEntry bash $EXIT_CODE "$CMD" $HISHTORY_START_TIME 2>&1 >/dev/null # Foreground Run
LAST_SAVED_COMMAND=$CMD LAST_SAVED_COMMAND=$CMD

View File

@ -14,8 +14,8 @@ function _hishtory_add() {
_hishtory_command=$1 _hishtory_command=$1
_hishtory_start_time=`hishtory getTimestamp` _hishtory_start_time=`hishtory getTimestamp`
if ! [ -z "$_hishtory_command " ]; then if ! [ -z "$_hishtory_command " ]; then
(hishtory presaveHistoryEntry zsh "$_hishtory_command" $_hishtory_start_time &) # Background Run (hishtory presaveHistoryEntry zsh "$_hishtory_command" $_hishtory_start_time &) 2>&1 >/dev/null # Background Run
# hishtory presaveHistoryEntry zsh "$_hishtory_command" $_hishtory_start_time # Foreground Run # hishtory presaveHistoryEntry zsh "$_hishtory_command" $_hishtory_start_time 2>&1 >/dev/null # Foreground Run
fi fi
} }
@ -27,8 +27,8 @@ function _hishtory_precmd() {
unset _hishtory_first_prompt unset _hishtory_first_prompt
return return
fi fi
(hishtory saveHistoryEntry zsh $_hishtory_exit_code "$_hishtory_command" $_hishtory_start_time &) # Background Run (hishtory saveHistoryEntry zsh $_hishtory_exit_code "$_hishtory_command" $_hishtory_start_time &) 2>&1 >/dev/null # Background Run
# hishtory saveHistoryEntry zsh $_hishtory_exit_code "$_hishtory_command" $_hishtory_start_time # Foreground Run # hishtory saveHistoryEntry zsh $_hishtory_exit_code "$_hishtory_command" $_hishtory_start_time 2>&1 >/dev/null # Foreground Run
(hishtory updateLocalDbFromRemote &) (hishtory updateLocalDbFromRemote &)
} }

View File

@ -0,0 +1,3 @@
Are you sure you want to uninstall hiSHtory and delete all locally saved history data [y/N]Do you have any feedback on why you're uninstallying hiSHtory? Type any feedback and then hit enter.
Feedback: Successfully uninstalled hishtory, please restart your terminal...
bash: /home/runner/.hishtory/hishtory: No such file or directory

View File

@ -1,2 +1,3 @@
Are you sure you want to uninstall hiSHtory and delete all locally saved history data [y/N]Do you have any feedback on why you're uninstallying hiSHtory? Type any feedback and then hit enter. Are you sure you want to uninstall hiSHtory and delete all locally saved history data [y/N]Do you have any feedback on why you're uninstallying hiSHtory? Type any feedback and then hit enter.
Feedback: Successfully uninstalled hishtory, please restart your terminal... Feedback: Successfully uninstalled hishtory, please restart your terminal...
_hishtory_precmd:8: command not found: hishtory