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

Don't expanding globs if user pass variables. #11946

Merged
merged 5 commits into from Feb 28, 2024

Conversation

WindSoilder
Copy link
Collaborator

@WindSoilder WindSoilder commented Feb 23, 2024

Description

Fixes: #11912

User-Facing Changes

After this change:

let x = '*.nu'; ^echo $x

will no longer expand glob.
If users still want to expand glob, there are also 3 ways to do this:

# 1. use spread operation with `glob` command
let x = '*.nu'; ^echo ...(glob $x)

Tests + Formatting

Done

After Submitting

NaN

@WindSoilder WindSoilder marked this pull request as draft February 24, 2024 03:32
@WindSoilder WindSoilder marked this pull request as ready for review February 24, 2024 07:57
@jcfj
Copy link

jcfj commented Feb 27, 2024

Thank you, this PR fixes a problem I just ran into today (apologies if there's some obvious workaround I'm missing):

The following script executes unreasonably slowly

1..50000 | par-each { mkdir $"foo/($in)" } # 2sec
1..500 | each { $"foo/($in)bar\\*" } | group 10 | each { ^echo ...$in } # 30sec

(The realworld usecase for this is working with nix derivation paths that look like this: /nix/store/zzsylzbjswd9jc47a5yrnlp8bhncnnf9-regex-1.10.2.drv^*.)

@WindSoilder WindSoilder added glob-expansion Specific behavior around file-system globbing with regular commands or `glob` pr:language This PR makes some language changes labels Feb 27, 2024
@WindSoilder WindSoilder merged commit eaedb30 into nushell:main Feb 28, 2024
19 checks passed
@hustcer hustcer added this to the v0.91.0 milestone Feb 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
glob-expansion Specific behavior around file-system globbing with regular commands or `glob` pr:language This PR makes some language changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

run-external is expanding globs (but shouldn't on Windows) with no way to opt out
4 participants