Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions bash-wakatime.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@
# hook function to send wakatime a tick
pre_prompt_command() {
version="1.0.0"
# shellcheck disable=SC2046,SC2005
entity=$(echo $(fc -ln -0) | cut -d ' ' -f1)
[ -z "$entity" ] && return # $entity is empty or only whitespace
$(git rev-parse --is-inside-work-tree 2> /dev/null) && local project="$(basename $(git rev-parse --show-toplevel))" || local project="Terminal"
(~/.wakatime/wakatime-cli --write --plugin "bash-wakatime/$version" --entity-type app --project "$project" --entity "$entity" 2>&1 > /dev/null &)
git rev-parse --is-inside-work-tree &> /dev/null && local project="$(basename "$(git rev-parse --show-toplevel)")" || local project="Terminal"
(~/.wakatime/wakatime-cli --write --plugin "bash-wakatime/$version" --entity-type app --project "$project" --entity "$entity" &> /dev/null &)
}

PROMPT_COMMAND="pre_prompt_command; $PROMPT_COMMAND"