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
glob with ../ prefix now works; #10504
Conversation
improve link to metacharacter help;
While I agree with this sentiment, we'll have to do something different because it doesn't work right in Windows due to verbatim paths that canonicalize returns. I believe this is the reason
|
…eview; Add tests for parent and quoted metachar in glob.
Whew! Ready for review! |
wow, that was a hard-fought battle. ⚔️ |
Looks much better on Windows
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Glad to see you finally got this working. I just removed some comments but I think it's ready too.
https://docs.rs/wax/0.5.0 doesn't include doc for the metachars, it links
to the repo page abov?. I think our link should go to a page that has this
information in it (somewhere)?
…On Thu, Sep 28, 2023 at 7:23 AM Jakub Žádník ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In crates/nu-command/src/filesystem/glob.rs
<#10504 (comment)>:
> @@ -123,7 +123,7 @@ impl Command for Glob {
}
fn extra_usage(&self) -> &str {
- r#"For more glob pattern help, please refer to https://github.com/olson-sean-k/wax"#
+ r#"For more glob pattern help, please refer to https://github.com/olson-sean-k/wax/blob/master/README.md#patterns"#
@bobhy <https://github.com/bobhy> Could you still use the shorter docs.rs
link?
—
Reply to this email directly, view it on GitHub
<#10504 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAPBIZFKCJLO2WWGGR3T2Z3X4WB4PANCNFSM6AAAAAA5HGXAAA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Ah yeah, wrong link. You could point at https://crates.io/crates/wax, for example (or maybe https://docs.rs/crate/wax) to show the README immediately. Not a big deal, though, I just thought the link was too long for a help message and the # reference might be prone to change. |
My changes were reverted by force pushes. So, I made the changes again to change the link and remove some excess comments. We can land this when it's green again. |
Fixes nushell#10503 Also improves link to metacharacter help; # Description `glob` code was using pattern as provided by user. If that had leading `..\`, `wax::Glob` is documented to treat them as literal chars to be matched. Fix is to use `wax::Glob.partition()` to split such invariant prefixes off the pattern and tack them onto the working directory computed separately. Before ``` > ls .. ╭───┬───────┬──────┬──────┬───────────────╮ │ # │ name │ type │ size │ modified │ ├───┼───────┼──────┼──────┼───────────────┤ │ 0 │ ../r1 │ dir │ 7 B │ 3 hours ago │ │ 1 │ ../r2 │ dir │ 3 B │ a day ago │ │ 2 │ ../r3 │ dir │ 13 B │ 4 minutes ago │ ╰───┴───────┴──────┴──────┴───────────────╯ > glob ../r* ╭────────────╮ │ empty list │ ╰────────────╯ ``` After ``` > glob ../r* ╭───┬──────────────────────────────╮ │ 0 │ /home/bobhy/src/rust/work/r2 │ │ 1 │ /home/bobhy/src/rust/work/r1 │ │ 2 │ /home/bobhy/src/rust/work/r3 │ ╰───┴──────────────────────────────╯ ``` # User-Facing Changes None # Tests + Formatting - 🟢 `toolkit fmt` - 🟢 `toolkit clippy` - 🟢 `toolkit test` - 🟢 `toolkit test stdlib` # After Submitting <!-- If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date. --> --------- Co-authored-by: Darren Schroeder <343840+fdncred@users.noreply.github.com>
Fixes #10503
Also improves link to metacharacter help;
Description
glob
code was using pattern as provided by user. If that had leading..\
,wax::Glob
is documented to treat them as literal chars to be matched.Fix is to use
wax::Glob.partition()
to split such invariant prefixes off the pattern and tack them onto the working directory computed separately.Before
After
User-Facing Changes
None
Tests + Formatting
toolkit fmt
toolkit clippy
toolkit test
toolkit test stdlib
After Submitting