parent
dd1c39c79e
commit
9b77c22011
1 changed files with 15 additions and 1 deletions
16
kb
16
kb
|
@ -234,11 +234,25 @@ listEntries(){
|
|||
vecho "listEntries $*"
|
||||
cd "$dataDir" || return
|
||||
local header="--header"
|
||||
[ "$1" = "--noheader" ] && header=""
|
||||
local typeorlist=""
|
||||
while [ "$#" -gt 0 ]; do
|
||||
case "$1" in
|
||||
--noheader) header="" ;;
|
||||
--normal) typeorlist+=" OR items.type = 'normal'" ;;
|
||||
--assets) typeorlist+=" OR items.type = 'assets'" ;;
|
||||
--links) typeorlist+=" OR items.type = 'links'" ;;
|
||||
*) die "invalid list option: '$1'." ;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
typeorlist="$(echo "$typeorlist" | sed 's/^ OR //')"
|
||||
[ -z "$typeorlist" ] && typeorlist="items.type = 'normal'"
|
||||
|
||||
echo "SELECT items.id,items.filename,items.title,items.type,
|
||||
GROUP_CONCAT(tags.name,',') tags
|
||||
FROM items LEFT JOIN links ON items.id = links.itemID
|
||||
LEFT JOIN tags ON links.tagID = tags.id
|
||||
WHERE $typeorlist
|
||||
GROUP BY items.id;" |
|
||||
sqlite3 --column $header "${sqliteFile}"
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue