+globlist=${globlist#'or '}
+
+cols=${cols%,}
+
+{
+ printf '.separator " "\n'
+ printf 'select %s\n' "$cols"
+
+ if [ $pkgonly -eq 0 ]; then
+ if [ -n "$cols" ]; then
+ printf ', '
+ fi
+
+ printf "case\n";
+ printf "when filetype = 'd' then rtrim(path,'/') || '/'\n"
+ printf "when filetype = 'l' then printf('%s -> %s', path, target)\n"
+ printf "else path end as path\n"
+ 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
+ case $config in
+ only) printf "and configuration = 1\n" ;;
+ exclude) printf "and configuration = 0\n" ;;
+ esac
+ printf 'order by pkgid,path\n'
+ printf ';\n'
+} | zpm shell $pkgfile
+#} | cat