mirror of
https://github.com/nushell/nushell
synced 2024-12-27 05:23:11 +00:00
387328fe73
# Description As title, currently on latest main, nushell confused user if it allows implicit casting between glob and string: ```nushell let x = "*.txt" def glob-test [g: glob] { open $g } glob-test $x ``` It always expand the glob although `$x` is defined as a string. This pr implements a solution from @kubouch : > We could make it really strict and disallow all autocasting between globs and strings because that's what's causing the "magic" confusion. Then, modify all builtins that accept globs to accept oneof(glob, string) and the rules would be that globs always expand and strings never expand # User-Facing Changes After this pr, user needs to use `into glob` to invoke `glob-test`, if user pass a string variable: ```nushell let x = "*.txt" def glob-test [g: glob] { open $g } glob-test ($x | into glob) ``` Or else nushell will return an error. ``` 3 │ glob-test $x · ─┬ · ╰── can't convert string to glob ``` # Tests + Formatting Done # After Submitting Nan |
||
---|---|---|
.. | ||
assets/nu_json | ||
const_ | ||
eval | ||
fixtures | ||
hooks | ||
modules | ||
overlays | ||
parsing | ||
path | ||
plugins | ||
scope | ||
shell | ||
main.rs |