-
Notifications
You must be signed in to change notification settings - Fork 87
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
Add regex support to Search.dataSets #2443
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: JWaters02 <watersjoshua2002@gmail.com>
Signed-off-by: JWaters02 <watersjoshua2002@gmail.com>
Signed-off-by: JWaters02 <watersjoshua2002@gmail.com>
Signed-off-by: JWaters02 <watersjoshua2002@gmail.com>
578629d
to
eb16bee
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2443 +/- ##
========================================
Coverage 91.50% 91.51%
========================================
Files 641 641
Lines 18376 18390 +14
Branches 3872 3990 +118
========================================
+ Hits 16815 16829 +14
Misses 1559 1559
Partials 2 2 ☔ View full report in Codecov by Sentry. |
Signed-off-by: JWaters02 <watersjoshua2002@gmail.com>
I couldn't figure out how to run the system tests for the |
The build CI is failing because the snapshot has changed, how do I commit that? |
You could run Thenk just push the corresponding snapshots which should be properly updated 😋 |
What It Does
Closes #2432
Implements the regex option on the data sets search:
?research
In #2432 I pondered about implementation of this option without causing a breaking change:
No one let me know what their thoughts on that were, but I think it is pretty straight forward that option 2 is the right way to go for v3. So what I implemented was a new, optional
--regex
option (please let me know if the name should be changed) that when specified sets the searchString into a regex one. If reasonable, I could open an issue with the code changes required to switch to option 1 that would go in as v4 breaking change.Obviously, one thing that needs to be taken into account, is that cases is not sensitive by default, which if combined with a regex string, may produce unintended effects - but that is up to the user (and the docs to point it out). For example, this regular expression specifies only upper case characters, but since the
--case-sensitive
option is not passed, it will match on the lower case characters anyway:I had to refactor the logic in
Search.dataSets
andSearch.searchLocal
functions to take into account that the matched string length, for the text highlighting in output, would not be the same as the search string length for a regex search string.Here are some random examples of using it:
How to Test
Run
zowe files search data-sets <pattern> <search string> --regex
and mess around with it!Review Checklist
I certify that I have:
Additional Comments
This will require a PR on the docs-site so go in alongside it.