diff options
| -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 |
