Jakub Žádník
Jakub Žádník
I don't think we need a new flag, you can do, e.g., `where {|x| try { $x.a > 1 } catch { false } }`
You won't be able to source a dynamic path passes as a command argument. However, we were thinking about expanding parse-time evaluation, so you'd be able to do the following...
https://github.com/nushell/nushell/pull/10326 will allow a sort-of conditional `use` or `source`, e.g., `use (if $spam { 'file1.nu' } else { 'file2.nu' })`.
You shouldn't call `use` in a for loop because definitions are scoped in Nushell, see https://www.nushell.sh/book/thinking_in_nu.html#think-of-nushell-as-a-compiled-language. It's better to organize custom completions as a module with `mod.nu` where you re-export...
Great the tests are working now! One question: What value will be stored in `x`?
Yeah, this is interesting, because parser still has the `x` definition (check `$nu.scope.vars`), but it's not in the Stack during evaluation. I think it's OK, but maybe good to keep...
That's because `""` string support escapes: the backslashes are interpreted as escapes. Try `''` instead.
Can you add example what didn't work for you? Do you mean ``` const p = '~/file.nu' source $p ``` ? I'm not a fan of auto-expanding tildes in strings...
Can this be closed now since https://github.com/nushell/nushell/pull/11488 was merged?
Both ``` 'C:\Users\kubouch' | str replace `C:\Users` 'foo' ``` and ``` 'C:\Users\kubouch' | str replace "C:\\Users" 'foo' ``` lead to the same error.