add str escape-glob command (#11664)

# Description
This pr is a follow up to #11621, it introduces a `str escape-glob`
command as a workaround for the case:

```nushell
let f = "a[123]b"
ls $f
```

It will glob `a[123]b`, we can get rid of the behavior through `str
escape-glob` command:

```nushll
let f = "a[123]b"
ls ($f | str escape-glob)
```

It's more useful in the `each` context:
`ls | get name | str escape-glob | each {|it| ls $it}`

# User-Facing Changes
NaN

# Tests + Formatting
Done

# After Submitting

---------

Co-authored-by: Darren Schroeder <343840+fdncred@users.noreply.github.com>
This commit is contained in:
WindSoilder
2024-01-29 23:00:15 +08:00
committed by GitHub
parent 427857a78e
commit 0e023eaa84
3 changed files with 95 additions and 0 deletions

View File

@ -174,6 +174,7 @@ pub fn add_shell_command_context(mut engine_state: EngineState) -> EngineState {
SplitColumn,
SplitRow,
SplitWords,
StrEscapeGlob,
Str,
StrCapitalize,
StrContains,