Rename reset_tracking and move function
This commit is contained in:
parent
bf73292fd0
commit
890236ced9
1 changed files with 11 additions and 11 deletions
|
@ -7,15 +7,6 @@ export AUTO_NOTIFY_IGNORE=(
|
||||||
"vim" "nvim" "less" "more" "man" "tig" "watch" "git commit" "top" "htop" "ssh" "nano"
|
"vim" "nvim" "less" "more" "man" "tig" "watch" "git commit" "top" "htop" "ssh" "nano"
|
||||||
)
|
)
|
||||||
|
|
||||||
function _reset_tracking() {
|
|
||||||
# Command start time in seconds since epoch
|
|
||||||
unset AUTO_COMMAND_START
|
|
||||||
# Full command that the user has executed after alias expansion
|
|
||||||
unset AUTO_COMMAND_FULL
|
|
||||||
# Command that the user has executed
|
|
||||||
unset AUTO_COMMAND
|
|
||||||
}
|
|
||||||
|
|
||||||
function _auto_notify_message() {
|
function _auto_notify_message() {
|
||||||
local command="$1"
|
local command="$1"
|
||||||
local elapsed="$2"
|
local elapsed="$2"
|
||||||
|
@ -68,7 +59,7 @@ function _auto_notify_send() {
|
||||||
|
|
||||||
# Empty tracking so that notifications are not
|
# Empty tracking so that notifications are not
|
||||||
# triggered for any commands not run (e.g ctrl+C when typing)
|
# triggered for any commands not run (e.g ctrl+C when typing)
|
||||||
_reset_tracking
|
_auto_notify_reset_tracking
|
||||||
}
|
}
|
||||||
|
|
||||||
function _auto_notify_track() {
|
function _auto_notify_track() {
|
||||||
|
@ -77,6 +68,15 @@ function _auto_notify_track() {
|
||||||
AUTO_COMMAND_START="$(date +"%s")"
|
AUTO_COMMAND_START="$(date +"%s")"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function _auto_notify_reset_tracking() {
|
||||||
|
# Command start time in seconds since epoch
|
||||||
|
unset AUTO_COMMAND_START
|
||||||
|
# Full command that the user has executed after alias expansion
|
||||||
|
unset AUTO_COMMAND_FULL
|
||||||
|
# Command that the user has executed
|
||||||
|
unset AUTO_COMMAND
|
||||||
|
}
|
||||||
|
|
||||||
function disable_auto_notify() {
|
function disable_auto_notify() {
|
||||||
add-zsh-hook -D preexec _auto_notify_track
|
add-zsh-hook -D preexec _auto_notify_track
|
||||||
add-zsh-hook -D precmd _auto_notify_send
|
add-zsh-hook -D precmd _auto_notify_send
|
||||||
|
@ -89,5 +89,5 @@ function enable_auto_notify() {
|
||||||
|
|
||||||
autoload -Uz add-zsh-hook
|
autoload -Uz add-zsh-hook
|
||||||
|
|
||||||
_reset_tracking
|
_auto_notify_reset_tracking
|
||||||
enable_auto_notify
|
enable_auto_notify
|
||||||
|
|
Loading…
Add table
Reference in a new issue