blob: 938d5fccfb19280b144a3ba9fc0fe1f081ccb0ef (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#!/usr/bin/env bash
#
# Timewarrior tag renamer.
#
# 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
|