Adds perge-tags option

master
Jonathan Hodgson 4 years ago
parent 6206986546
commit a504c212ef
  1. 7
      inc/tag-management
  2. 2
      kb

@ -75,3 +75,10 @@ listTags(){
GROUP BY tags.id" |
sqlite3 --column $header "${sqliteFile}"
}
purgeTags(){
vecho "purgeTags $*"
echo "DELETE FROM tags WHERE id IN (
SELECT id FROM tags WHERE id NOT IN (SELECT tagID FROM links)
)"| sqlite3 --column --header "${sqliteFile}"
}

2
kb

@ -314,6 +314,7 @@ mainScript() {
list-tags) listTags "${args[@]:1}"; safeExit ;;
makedb) makedb; safeExit ;;
new) newFile "${args[@]:1}"; safeExit ;;
purge-tags) purgeTags "${args[@]:1}"; safeExit ;;
update) updateFileChange "${args[@]:1}"; safeExit ;;
view) viewFile "${args[@]:1}"; safeExit ;;
@ -358,6 +359,7 @@ usage() {
--normal List items of type \"normal\"
list-tags Lists tags with the number of times its used
--noheader Don't include the header
purge-tags Deletes any unused tags
update <file> [<file>] Updates the database and git repo of a changed file
If 2 files are given, it assumes a move
view View a file

Loading…
Cancel
Save