diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2024-11-11 14:23:45 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2024-11-11 14:23:45 -0300 |
commit | 1af2d38b7a75f6295bea3b0c71802afe826f2afb (patch) | |
tree | cce6903899b846acc66434d2b96132bd8468c8a7 | |
parent | 3c5c672e47737e6b3342dfeb730ccd8320f2d442 (diff) | |
download | utils-organization-1af2d38b7a75f6295bea3b0c71802afe826f2afb.tar.gz utils-organization-1af2d38b7a75f6295bea3b0c71802afe826f2afb.tar.bz2 |
Feat: adds timew-tagrename
-rwxr-xr-x | timew-tagrename | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/timew-tagrename b/timew-tagrename new file mode 100755 index 0000000..06edd98 --- /dev/null +++ b/timew-tagrename @@ -0,0 +1,29 @@ +#!/usr/bin/env bash +# +# Timewarrior tag renames. +# + +# Parameters +BASENAME="`basename $0`" +OLD="$1" +NEW="$2" + +# Rename tag: use as timew-tagrename <oldtag> <newtag> +# Based on from https://github.com/GothenburgBitFactory/timewarrior/issues/210 +function timew_tagrename() { + oldtag="$1" + newtag="$2" + idlist="$(timew summary 1970W01 - now "$oldtag" :ids | sed -nr 's/.* (@[0-9]+) .*/\1/p')" + + timew tag $idlist "$newtag" + timew untag $idlist "$oldtag" +} + +# Check +if [ -z "$NEW" ]; then + echo "usage: $BASENAME <old-tag> <new-tag>" + exit 1 +fi + +# Dispatch +timew_tagrename $OLD $NEW |