diff options
| author | Tristan Riehs <tristan.riehs@inria.fr> | 2026-07-01 16:56:49 +0200 |
|---|---|---|
| committer | Tristan Riehs <tristan.riehs@inria.fr> | 2026-07-01 16:56:49 +0200 |
| commit | 4d92ae3cdf5b5c163abc6f22370813a4fd5b9bc8 (patch) | |
| tree | e494f41e2346a8cfaee64c5f22da38a501fd3edc | |
| parent | 43e55c10dd610a28aaeb5296a16b63587eb8f9c9 (diff) | |
Improve ftag_tag_all script
| -rwxr-xr-x | shell/ftag_tag_all.sh | 15 |
1 files 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 |
