We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
It's not possible to drop optional fields. The following is an example with an optional key and value pair:
key
value
> dirdf::dirdf_parse(c("foo,tag=100.rds", "bar.rds"), template = "name,key?=value?.ext") name key value ext pathname 1 foo tag 100 rds foo,tag=100.rds 2 bar <NA> <NA> rds bar.rds
However, it is not safe to drop an optional field because it may result in "unexpected paths". For example, if we try to drop the key fields, we get:
> dirdf::dirdf_parse(c("foo,tag=100.rds", "bar.rds"), template = "name,~key?~=value?.ext") Error in dirdf::dirdf_parse(c("foo,tag=100.rds", "bar.rds"), template = "name,~key?~=value?.ext") : Unexpected path(s) found: bar.rds
Ideally we would get:
> dirdf::dirdf_parse(c("foo,tag=100.rds", "bar.rds"), template = "name,~key~?=value?.ext") name value ext pathname 1 foo 100 rds foo,tag=100.rds 2 bar <NA> rds bar.rds
The text was updated successfully, but these errors were encountered:
Clarification, without non-matching files, it works, e.g.
> dirdf::dirdf_parse("foo,tag=100.rds", template = "name,~key?~=value?.ext") name value ext pathname 1 foo 100 rds foo,tag=100.rds
BTW, this format doesn't give an error but the wrong result:
> dirdf::dirdf_parse("foo,tag=100.rds", template = "name,~key~?=value?.ext") name value ext pathname 1 foo <NA> rds foo,tag=100.rds
Sorry, something went wrong.
Protect against ~name~? - should be ~name?~ [#17]
9a825ee
TESTS: Assert that drop patterns works [#17]
33d787f
Now ~key~? gives an error:
~key~?
> dirdf::dirdf_parse("foo,tag=100.rds", template = "name,~key~?=value?.ext") Error in templateToRegex(template) : Invalid template. ~name~? is invalid whereas ~name?~ is valid: ‘name,~key~?=value?.ext’
No branches or pull requests
It's not possible to drop optional fields. The following is an example with an optional
key
andvalue
pair:However, it is not safe to drop an optional field because it may result in "unexpected paths". For example, if we try to drop the
key
fields, we get:Ideally we would get:
The text was updated successfully, but these errors were encountered: