From 4d92ae3cdf5b5c163abc6f22370813a4fd5b9bc8 Mon Sep 17 00:00:00 2001 From: Tristan Riehs Date: Wed, 1 Jul 2026 16:56:49 +0200 Subject: Improve ftag_tag_all script --- shell/ftag_tag_all.sh | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/shell/ftag_tag_all.sh b/shell/ftag_tag_all.sh index 501b38a..884c686 100755 --- a/shell/ftag_tag_all.sh +++ b/shell/ftag_tag_all.sh @@ -4,12 +4,11 @@ # are. Performing the same action in a more elegant and flexible way will be # done in the future. -database="$HOME/.cache/ftag/ftag.sqlite3" -ftag_bin='ftag' +database="${HOME}/.cache/ftag/ftag.sqlite3" files=$(sqlite3 -list "$database" 'SELECT canonical_name FROM files;') echo "Available tags" -"$ftag_bin" tag list +ftag tag list for file in $files do @@ -19,11 +18,17 @@ do echo "Id is ${file_id}" file_tags=$(sqlite3 -list "$database" "SELECT name FROM (SELECT * FROM file_tags WHERE file = ${file_id}) JOIN tags ON tag = id;") - echo "File already has tags ${file_tags}" + if [ -n "$file_tags" ] + then + echo "File already has tags ${file_tags}" + else + echo 'File has no tag' + fi + read tags for tag in $tags do echo "Tag $tag" - "$ftag_bin" file tag "$file" "$tag" + ftag file tag "$file" "$tag" done done -- cgit v1.2.3