+globlist=${globlist#'or '}
+
+cols=${cols%,}
+
+{
+ printf '.separator " "\n'
+ printf 'select %s\n' "$cols"
+
+ if [ $pkgonly -eq 0 ]; then
+ if [ -n "$cols" ]; then
+ printf ', '
+ fi
+
+ cat <<-EOC
+ case when filetype = 'd' then
+ rtrim(path,'/') || '/'
+ when filetype = 'l' then
+ printf('%s -> %s', path, target)
+ else
+ path
+ end as path
+ EOC
+ fi
+ printf 'from packagefiles_pkgid\nwhere true\n'
+ if [ -n "$globlist" ]; then
+ printf "and (%s)\n" "$globlist"
+ fi
+ if [ -n "$pkglist" ]; then
+ printf "and pkgid in (%s)\n" "$pkglist"
+ fi
+ printf 'order by pkgid,path\n'
+ printf ';\n'
+} | zpm shell $pkgfile
+#} | cat