zsh: filter some secrets

This commit is contained in:
tastytea 2022-10-28 03:44:57 +02:00
parent 21c4f6212d
commit b04595ac91
Signed by: tastytea
SSH Key Fingerprint: SHA256:FBkvrOlhq5use1XEttyUGT4bUTDVA1ar9SgIc9P03cM

View File

@ -36,15 +36,26 @@ setopt NO_SHARE_HISTORY EXTENDED_HISTORY INC_APPEND_HISTORY_TIME
setopt HIST_EXPIRE_DUPS_FIRST HIST_IGNORE_DUPS
setopt HIST_IGNORE_SPACE HIST_REDUCE_BLANKS HIST_VERIFY HIST_FCNTL_LOCK
autoload -Uz add-zsh-hook
# Import new commands from the history file
function _my_import_history_zshaddhistory()
{
fc -RI
return 0
}
autoload -Uz add-zsh-hook
add-zsh-hook zshaddhistory _my_import_history_zshaddhistory
function _my_filter_secrets_zshaddhistory() {
case ${1} in
*"Authorization: Bearer"*)
return 1 ;;
*"--password"*)
return 1 ;;
esac
return 0
}
add-zsh-hook zshaddhistory _my_filter_secrets_zshaddhistory
############################## Plugins #########################################
# https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/docs/highlighters.md