From a9f9d2203476b97c7aae6ad639e52c6400a0e050 Mon Sep 17 00:00:00 2001 From: Lars Vierbergen Date: Wed, 17 Jul 2019 22:21:27 +0200 Subject: [PATCH 1/2] In some zsh setups, when history is disabled, $1 is always empty. When history is disabled, $1 is always empty, but the command is present in $2 and $3. To get at least some functionality, although commands without aliases expanded are not available now, use $2 when $1 is empty. --- auto-notify.plugin.zsh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/auto-notify.plugin.zsh b/auto-notify.plugin.zsh index cd40ba7..30fca93 100644 --- a/auto-notify.plugin.zsh +++ b/auto-notify.plugin.zsh @@ -63,7 +63,10 @@ function _auto_notify_send() { } function _auto_notify_track() { - AUTO_COMMAND="$1" + # $1 is the string the user typed, but only when history is enabled + # $2 is a single-line, size-limited version of the command that is always available + # To still do something useful when history is disabled, although with reduced functionality, fall back to $2 when $1 is empty + AUTO_COMMAND="${1:-$2}" AUTO_COMMAND_FULL="$3" AUTO_COMMAND_START="$(date +"%s")" } From 5c2ad8bd7aa4d6550d4c311fcc98c9ed0386033f Mon Sep 17 00:00:00 2001 From: Michael Aquilina Date: Thu, 18 Jul 2019 10:33:46 +0100 Subject: [PATCH 2/2] Bump version to 0.3.0 --- CHANGELOG.md | 4 ++++ auto-notify.plugin.zsh | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 69a07f6..60a990f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ Changelog for zsh-auto-notify ============================= +0.3.0 +----- +* Add support for environments where standard history is disabled. Fixed in #10 + 0.2.0 ----- * Initial stable release diff --git a/auto-notify.plugin.zsh b/auto-notify.plugin.zsh index 30fca93..0944e38 100644 --- a/auto-notify.plugin.zsh +++ b/auto-notify.plugin.zsh @@ -1,4 +1,4 @@ -export AUTO_NOTIFY_VERSION="0.2.0" +export AUTO_NOTIFY_VERSION="0.3.0" # Threshold in seconds for when to automatically show a notification export AUTO_NOTIFY_THRESHOLD=10