From b16450830130fd70a1643fa90ae8517c0810c1d8 Mon Sep 17 00:00:00 2001 From: tupywebteam <50232450+tupywebteam@users.noreply.github.com> Date: Wed, 10 May 2023 09:55:39 -0300 Subject: [PATCH 1/3] Fix error when run command exit --- conf.d/wakatime.fish | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/conf.d/wakatime.fish b/conf.d/wakatime.fish index ba86190..6189021 100644 --- a/conf.d/wakatime.fish +++ b/conf.d/wakatime.fish @@ -9,6 +9,14 @@ function __register_wakatime_fish_before_exec -e fish_preexec if set -q FISH_WAKATIME_DISABLED return 0 end + + set -l last_command + + set last_command (echo $history[1] | cut -d ' ' -f1) + + if test "$last_command" = 'exit' + return 0 + end set -l PLUGIN_NAME "ik11235/wakatime.fish" set -l PLUGIN_VERSION "0.0.3" @@ -31,5 +39,5 @@ function __register_wakatime_fish_before_exec -e fish_preexec set project "Terminal" end - $wakatime_path --write --plugin "$PLUGIN_NAME/$PLUGIN_VERSION" --entity-type app --project "$project" --entity (echo $history[1] | cut -d ' ' -f1) &> /dev/null& + $wakatime_path --write --plugin "$PLUGIN_NAME/$PLUGIN_VERSION" --entity-type app --project "$project" --entity "$last_command" &> /dev/null& end From a953b9a6f29e9e1a321d8946cbfbcef688fa5e92 Mon Sep 17 00:00:00 2001 From: tupywebteam <50232450+tupywebteam@users.noreply.github.com> Date: Wed, 10 May 2023 09:57:18 -0300 Subject: [PATCH 2/3] Update plugin version --- conf.d/wakatime.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf.d/wakatime.fish b/conf.d/wakatime.fish index 6189021..c332857 100644 --- a/conf.d/wakatime.fish +++ b/conf.d/wakatime.fish @@ -19,7 +19,7 @@ function __register_wakatime_fish_before_exec -e fish_preexec end set -l PLUGIN_NAME "ik11235/wakatime.fish" - set -l PLUGIN_VERSION "0.0.3" + set -l PLUGIN_VERSION "0.0.4" set -l project set -l wakatime_path From 063b65f5d01d81a1351a879b60c7a89fbb7e6314 Mon Sep 17 00:00:00 2001 From: ik-fib Date: Wed, 27 Mar 2024 18:55:45 +0900 Subject: [PATCH 3/3] fix use fish_preexec -> fish_postexec --- conf.d/wakatime.fish | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/conf.d/wakatime.fish b/conf.d/wakatime.fish index c332857..264fc9b 100644 --- a/conf.d/wakatime.fish +++ b/conf.d/wakatime.fish @@ -5,16 +5,16 @@ # see: https://github.com/ik11235/wakatime.fish ### -function __register_wakatime_fish_before_exec -e fish_preexec +function __register_wakatime_fish_before_exec -e fish_postexec if set -q FISH_WAKATIME_DISABLED return 0 end - set -l last_command + set -l exec_command_str - set last_command (echo $history[1] | cut -d ' ' -f1) + set exec_command_str (echo $argv | cut -d ' ' -f1) - if test "$last_command" = 'exit' + if test "$exec_command_str" = 'exit' return 0 end @@ -39,5 +39,5 @@ function __register_wakatime_fish_before_exec -e fish_preexec set project "Terminal" end - $wakatime_path --write --plugin "$PLUGIN_NAME/$PLUGIN_VERSION" --entity-type app --project "$project" --entity "$last_command" &> /dev/null& + $wakatime_path --write --plugin "$PLUGIN_NAME/$PLUGIN_VERSION" --entity-type app --project "$project" --entity "$exec_command_str" &> /dev/null& end