From c38dd69bb7cb34738bc37039718633b390b76686 Mon Sep 17 00:00:00 2001 From: Puria Nafisi Azizi Date: Thu, 19 Nov 2020 09:33:01 +0100 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20=F0=9F=90=B3=20=20Support=20fish=20?= =?UTF-8?q?shell?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gtm-plugin.fish | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 gtm-plugin.fish diff --git a/gtm-plugin.fish b/gtm-plugin.fish new file mode 100755 index 0000000..1f68317 --- /dev/null +++ b/gtm-plugin.fish @@ -0,0 +1,22 @@ +#!/usr/bin/env fish + +set -x GTM_STATUS "" +set -x GTM_NEXT_UPDATE 0 +set -x GTM_LAST_DIR {$PWD} + +function gtm_record_terminal --on-event fish_prompt + set epoch (date +%s) + if test $GTM_LAST_DIR != {$PWD} -o $epoch -ge $GTM_NEXT_UPDATE + set -x GTM_NEXT_UPDATE (math $epoch + 30) + set -x GTM_LAST_DIR {$PWD} + if set -q GTM_STATUS_ONLY + set -x GTM_STATUS (gtm status -total-only) + else + set -x GTM_STATUS (gtm record -terminal -status) + end + if test $status -ne 0 + echo "Error running 'gtm record -terminal -status', you may need to install gtm or upgrade to the latest" + echo "See http://www.github.com/git-time-metric/gtm for how to install" + end + end +end From 6c018602c92487a14e456f9267962e20cdf8488e Mon Sep 17 00:00:00 2001 From: Puria Nafisi Azizi Date: Thu, 19 Nov 2020 09:38:04 +0100 Subject: [PATCH 2/2] =?UTF-8?q?docs:=20=F0=9F=93=9D=20=20Update=20docs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7b0338b..cbfb64d 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,14 @@ Git Time Metrics (GTM) is a tool to automatically track time spent reading and w Installing GTM is a two step process. First, it's recommended you install the GTM executable that the plug-in integrates with and then install the Terminal GTM plug-in. Please submit an issue if you have any problems and/or questions. 1. Follow the [Getting Started](https://github.com/git-time-metric/gtm/blob/master/README.md) section to install the GTM executable for your operating system. -2. To install the plugin download the shell script and `source gtm-plugin.sh` from either your .bashrc or .zshrc file. Also make sure the shell script is executable `chmod +x gtm-plugin.sh`. + +#### Bash/Zsh +To install the plugin download the shell script and `source gtm-plugin.sh` from either your .bashrc or .zshrc file. Also make sure the shell script is executable `chmod +x gtm-plugin.sh`. + +#### Fish +To install the plugin download the fish script and `source gtm-plugin.fish` from +`~/.config/fish/config.fish` + **Note** - to enable time tracking for a Git repository, you need to initialize it with `gtm init` otherwise it will be ignored by GTM. This is done via the command line. ```