Skip to content

Support globbing #80

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dantleech opened this issue Aug 11, 2014 · 5 comments · Fixed by #113
Closed

Support globbing #80

dantleech opened this issue Aug 11, 2014 · 5 comments · Fixed by #113

Comments

@dantleech
Copy link
Member

It would be great to support at least wildcards:

PHPCRSH> node:remove *
PHPCRSH> node:remove foobar*

PHPCRSH> node:remove en_us/*

If not something more complete, I wonder if there are any libraries for this

@dbu
Copy link
Member

dbu commented Aug 11, 2014

for direct children, phpcr itself supports globbing

@dantleech
Copy link
Member Author

Yep: http://www.day.com/specs/jcr/2.0/5_Reading.html#5.2.2.1 Name Patterns

I think it would be relatively simple to implement something which expands paths containing globs, e.g. it should be possible to support:

PHPCRSH> ls /*/foo/*
PHPCRSH> rm *.txt
PHPCRSH> cp foo* foo/

We would just have to implement something which resolves a globbed path to an array of nodes.

The only implementation difficulty I can see is determining if a given path segment is a glob or not:

  1. We could first check to see if the given node exists and if it doesn't check if the parent exists - if the parent exists we assume the suffix is a glob.
  2. If the basename contains a * character then treat as a glob.
  3. Always treat the basename as a glob, unless there is a concrete node at the given path

@dbu
Copy link
Member

dbu commented Aug 15, 2014

i would only glob when there is an explicit *. otherwise there are too
many ambiguities. * is not valid in a node name, or is it?

@dantleech
Copy link
Member Author

Also would be great to do something like:

PHPCRSH> ls /cmf/foobar/contents/articles/*/jcr:uuid

@dantleech dantleech mentioned this issue Nov 30, 2014
3 tasks
@dantleech
Copy link
Member Author

Closing in favor of PR #113

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants