Skip to content

update nu-glob based on latest glob 0.3.1 changes - #9099

Merged
fdncred merged 5 commits into
nushell:mainfrom
fdncred:nu_glob_update
May 8, 2023
Merged

fdncred merged 5 commits into
nushell:mainfrom
fdncred:nu_glob_update

Conversation

@fdncred

@fdncred fdncred commented May 4, 2023

Copy link
Copy Markdown
Contributor

Description

This PR updates nu-glob to add the latest changes and updates from rust-lang/glob v0.3.1.

With these changes you can do this type of globbing

/// - `?` matches any single character.
///
/// - `*` matches any (possibly empty) sequence of characters.
///
/// - `**` matches the current directory and arbitrary subdirectories. This
///   sequence **must** form a single path component, so both `**a` and `b**`
///   are invalid and will result in an error.  A sequence of more than two
///   consecutive `*` characters is also invalid.
///
/// - `[...]` matches any character inside the brackets.  Character sequences
///   can also specify ranges of characters, as ordered by Unicode, so e.g.
///   `[0-9]` specifies any character between 0 and 9 inclusive. An unclosed
///   bracket is invalid.
///
/// - `[!...]` is the negation of `[...]`, i.e. it matches any characters
///   **not** in the brackets.
///
/// - The metacharacters `?`, `*`, `[`, `]` can be matched by using brackets
///   (e.g. `[?]`).  When a `]` occurs immediately following `[` or `[!` then it
///   is interpreted as being part of, rather then ending, the character set, so
///   `]` and NOT `]` can be matched by `[]]` and `[!]]` respectively.  The `-`
///   character can be specified inside a character sequence pattern by placing
///   it at the start or the end, e.g. `[abc-]`.

Example - with character sequences
image

Example - with character sequence negation
image

Example - normal globbing
image

Example - with character sequences
image

Not that, if you're using a character sequence by itself, you need to enclose it in quotes, otherwise nushell will think it's a range. But if you already have a type of a bare word already, no quotes are necessary, as in the last example.

User-Facing Changes

Tests + Formatting

After Submitting

@WindSoilder

Copy link
Copy Markdown
Contributor

Cool! It's a surprise to see rust-lang/glob updated again

@fdncred

fdncred commented May 4, 2023

Copy link
Copy Markdown
Contributor Author

I wish I could figure out the problem here. Something weird is going on and I can't seem to fix it in the tests.

@fdncred
fdncred marked this pull request as draft May 4, 2023 22:47
@fdncred
fdncred marked this pull request as ready for review May 8, 2023 14:02
@codecov

codecov Bot commented May 8, 2023

Copy link
Copy Markdown

Codecov Report

Merging #9099 (475bd74) into main (b82e279) will increase coverage by 0.08%.
The diff coverage is 97.07%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #9099      +/-   ##
==========================================
+ Coverage   68.77%   68.85%   +0.08%     
==========================================
  Files         639      641       +2     
  Lines      101514   102315     +801     
==========================================
+ Hits        69816    70450     +634     
- Misses      31698    31865     +167     
Impacted Files Coverage Δ
crates/nu-glob/src/lib.rs 92.22% <97.05%> (+1.35%) ⬆️
crates/nu-command/src/filesystem/ls.rs 80.25% <100.00%> (ø)

... and 18 files with indirect coverage changes

@fdncred

fdncred commented May 8, 2023

Copy link
Copy Markdown
Contributor Author

Let's land this while we still have some time to dog-food before the release.

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 this pull request may close these issues.

2 participants