Skip to content
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

When listing paths, filter value with a predicate #154

Closed
ABridoux opened this issue Jan 28, 2021 · 0 comments · Fixed by #156
Closed

When listing paths, filter value with a predicate #154

ABridoux opened this issue Jan 28, 2021 · 0 comments · Fixed by #156
Labels
enhancement New feature or request
Milestone

Comments

@ABridoux
Copy link
Owner

ABridoux commented Jan 28, 2021

Describe your idea briefly.
The library could offer the possibility to filter listed paths with the paths command based on the value.

Describe the solution you'd like
A predicate could be used to specify how to filter. To throw a relevant error and not crash, the NSPredicate cannot be used. The library could rather use BooleanExpressionEvaluation.

Possible syntax with the -v|--value option.

scout paths -v "value > 10" # keep the number values greater than 10
scout paths -v "value <= 10" # keep the number values lesser than or equal to 10
scout paths -v "10 <= value && value <= 15" # keep the number values between 10 and 15
scout paths -v "value hasPrefix 'hobb'" # keep the values that start with "hobb"
scout paths -v "value matches '[0-9]{3}'" # keep the values composed of exactly 3 digits.

Additional context
The -v|--value option should work coherently with the remaining arguments:

  • initial path
  • filter on the keys -k|--key option
@ABridoux ABridoux added the enhancement New feature or request label Jan 28, 2021
@ABridoux ABridoux modified the milestones: 2.2.0, 2.1.0 Jan 28, 2021
@ABridoux ABridoux linked a pull request Feb 4, 2021 that will close this issue
ABridoux added a commit that referenced this issue Feb 4, 2021
@ABridoux ABridoux closed this as completed Feb 4, 2021
@ABridoux ABridoux mentioned this issue Feb 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant