Skip to content

Commit

Permalink
Merge pull request #141 from line-o/fix/list-regex
Browse files Browse the repository at this point in the history
  • Loading branch information
reinhapa authored Oct 5, 2023
2 parents cacb629 + 61ac91c commit 3f5f053
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
20 changes: 11 additions & 9 deletions commands/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -433,15 +433,17 @@ function getListRenderer (options, renderItem, sortItemList) {
*/
async function ls (db, collection, options) {
const { glob, long, tree, recursive, depth } = options
const result = await db.queries.readAll(query, {
variables: {
collection,
glob,
depth,
recursive: tree || recursive,
'collections-only': options['collections-only']
}
})
const variables = {
collection,
glob,
depth,
recursive: Boolean(tree || recursive),
'collections-only': options['collections-only']
}
if (options.debug) {
console.log(variables)
}
const result = await db.queries.readAll(query, { variables })
const raw = result.pages.toString()
const json = JSON.parse(raw)
if (json.error) {
Expand Down
2 changes: 1 addition & 1 deletion modules/list-resources.xq
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ declare function local:get-children ($collection as xs:string, $current-level as
};

declare function local:list ($collection as xs:string, $options as map(*)) as map(*) {
let $normalized-collection := replace($collection, "^(.*?)/?$", "$1")
let $normalized-collection := replace($collection, "^(.+?)/?$", "$1")
let $parent-collection := replace($normalized-collection, "(/[^/]+)$", "")
let $collection-name := replace($normalized-collection, "^(.*?/)([^/]+)$", "$2")
return
Expand Down

0 comments on commit 3f5f053

Please sign in to comment.