From 378d91ca0ea91433d7f8855c9c63ec2f9cfdff64 Mon Sep 17 00:00:00 2001 From: dogeystamp Date: Fri, 28 Jul 2023 19:21:40 -0400 Subject: [PATCH] tagger.sh: allow tagging existing files --- src/.local/bin/tagger.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/.local/bin/tagger.sh b/src/.local/bin/tagger.sh index fc9e9b1..0be02ad 100755 --- a/src/.local/bin/tagger.sh +++ b/src/.local/bin/tagger.sh @@ -1,6 +1,7 @@ #!/bin/sh # wrapper over tmsu for easy tagging # tags untagged files for the database in the current working directory +# or pipe in a list of files to tag set -e @@ -60,7 +61,11 @@ appendargs() { } INPUT_FILE="$(mktemp)" -tmsu untagged > "$INPUT_FILE" +if [ -t 0 ]; then + tmsu untagged > "$INPUT_FILE" +else + cat /dev/stdin > "$INPUT_FILE" +fi # this seems to magically fix some tmsu issue i don't really understand # tmsu freezes for a second or two @@ -71,7 +76,10 @@ while read -r FILE; do continue fi + tmsu tags -1 "$FILE" | tail -n+2 > "$TMSU_ARGS" + view "$FILE" + appendargs while true; do