nushell: Glob expansion should not happen for external commands when quoted
Describe the bug
Currently it’s impossible to pass a glob-like string to an external command, as nushell expands globs even when quoted.
Some commands like the UI testing framework cypress allow passing in filter globs, I believe jest offers similar arguments.
How to reproduce
> npx run cypress --spec "cypress/integration/**/*"
(or any external command that takes a glob string)
Expected behavior
Expected:
npx run cypress "--spec" "cypress/integration/**/*"
Actual:
npx run cypress "--spec" "<file1>" "<file2>" "<file3>" "<etc>"
Screenshots
No response
Configuration
| key | value |
| ------------------ | ---------------------------------------- |
| version | 0.59.0 |
| branch | main |
| short_commit | 3c62d27c |
| commit_hash | 3c62d27c280dd7a7ba276760c239bfaa1b5080cd |
| commit_date | 2022-02-24 19:02:28 +00:00 |
| build_os | macos-x86_64 |
| rust_version | rustc 1.58.1 (db9d1b20b 2022-01-20) |
| rust_channel | stable-x86_64-apple-darwin |
| cargo_version | cargo 1.58.0 (f01b232bc 2022-01-19) |
| pkg_version | 0.59.0 |
| build_time | 2022-02-24 12:20:29 -08:00 |
| build_rust_channel | release |
| features | default, which |
| installed_plugins | |
Additional context
Single quotes, double quotes, or unquoted all result in the same
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 16 (10 by maintainers)
FWIW, POSIX sh meets all of those requirements with somewhat awkward syntax:
*.toml"*.toml""my files/"*".toml""my files/*.toml"I see. Certainly a quandry. Could we offer single quotes or backticks as alternatives - or perhaps something similar to the
$""syntax to indicate an escaped string? I’m curious how windows-based shells like powershell or cygwin do escaping for regexes -\is a pretty standard escape character across several platforms so I’d be surprised there isn’t a windows work-around to avoid pathname collisions.I’m wary of any nushell-specific glob syntax given that external commands generally require a POSIX or Bash-style format, not to mention other regex parameters that include
*but if we can figure out a decent quoting mechanism for indicating “leave this string alone” that would be great.I agree there but do we need to reinvent the wheel? quoting things is generally how you say “use this as-is” - even google search uses quotes for exact match
@lukexor - thinking about this for a minute - currently using quotes is how we allow you to get to filepaths that have spaces in them. I wonder if we need a way of saying “do not expand this string”