@ -204,12 +204,14 @@ gitChange(){
listEntries(){
listEntries(){
vecho "listEntries $*"
vecho "listEntries $*"
cd "$dataDir" || return
cd "$dataDir" || return
local header="--header"
[ "$1" = "--noheader" ] && header=""
echo "SELECT items.id,items.filename,items.title,items.type,
echo "SELECT items.id,items.filename,items.title,items.type,
GROUP_CONCAT(tags.name,',') tags
GROUP_CONCAT(tags.name,',') tags
FROM items LEFT JOIN links ON items.id = links.itemID
FROM items LEFT JOIN links ON items.id = links.itemID
LEFT JOIN tags ON links.tagID = tags.id
LEFT JOIN tags ON links.tagID = tags.id
GROUP BY items.id;" |
GROUP BY items.id;" |
sqlite3 --column -- header "${sqliteFile}"
sqlite3 --column $ header "${sqliteFile}"
}
}
fuzzySelect(){
fuzzySelect(){
@ -301,6 +303,7 @@ mainScript() {
new) newFile "${args[@]:1}"; safeExit ;;
new) newFile "${args[@]:1}"; safeExit ;;
edit) editFile "${args[@]:1}"; safeExit ;;
edit) editFile "${args[@]:1}"; safeExit ;;
list) listEntries "${args[@]:1}"; safeExit ;;
list) listEntries "${args[@]:1}"; safeExit ;;
list-tags) listTags "${args[@]:1}"; safeExit ;;
view) viewFile "${args[@]:1}"; safeExit ;;
view) viewFile "${args[@]:1}"; safeExit ;;
fuzzy) fuzzySelect "${args[@]:1}"; safeExit ;;
fuzzy) fuzzySelect "${args[@]:1}"; safeExit ;;
deepsearch) deepSearch "${args[@]:1}"; safeExit ;;
deepsearch) deepSearch "${args[@]:1}"; safeExit ;;
@ -341,6 +344,9 @@ usage() {
--filetype <type> Type of file ( default md)
--filetype <type> Type of file ( default md)
edit [title] Edit a file
edit [title] Edit a file
list List all files
list List all files
--noheader Don't include the header
list-tags Lists tags with the number of times its used
--noheader Don't include the header
view View a file
view View a file
fuzzy [command] Fuzzy select a file
fuzzy [command] Fuzzy select a file
command is what to do with the selected file
command is what to do with the selected file