mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-30 02:44:42 +01:00
fix(history): add warning before deleting command history in history -c (#12472)
This commit is contained in:
parent
775e747d49
commit
dbfd854ae3
1 changed files with 3 additions and 2 deletions
|
|
@ -9,8 +9,9 @@ function omz_history {
|
|||
|
||||
# confirm action before deleting history
|
||||
print -nu2 "This action will irreversibly delete your command history. Are you sure? [y/N] "
|
||||
builtin read -E
|
||||
[[ "$REPLY" = [yY] ]] || return 0
|
||||
builtin read -k1
|
||||
[[ "$REPLY" = $'\n' ]] || print -u2
|
||||
[[ "$REPLY" != ([nN]|$'\n') ]] || return 0
|
||||
|
||||
print -nu2 >| "$HISTFILE"
|
||||
fc -p "$HISTFILE"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue