You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: blog/2025-07-23-nushell_0_106_0.md
+72-69Lines changed: 72 additions & 69 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -182,22 +182,24 @@ If you want to opt in and try them out yourself, you can enable them in the foll
182
182
nu --experimental-options=[reorder-cell-paths,..]
183
183
```
184
184
185
-
> [!Tip] Live on the edge
186
-
> If you want to have all available experimental options on, rather than specifying them one by one, you can just use `all`!
187
-
188
-
> [!Note] Enabling experimental options
189
-
> If you use Nushell as your default shell in your terminal emulator, simply add whatever experimental options you'd like in your terminal config.
190
-
191
-
> On the other hand, if you use Nushell as your login shell, a quick (if not the most elegant) way to set this up is to put this snippet into your config (this example uses `all`):
192
-
>
193
-
> ```nushell
194
-
> if $nu.is-login and $env.NU_EXPERIMENTAL_OPTIONS? != "all" {
195
-
> $env.NU_EXPERIMENTAL_OPTIONS = "all"
196
-
> exec $nu.current-exe
197
-
> }
198
-
> ```
199
-
>
200
-
> The first time your login shell runs, this snippet will relaunch it with the `NU_EXPERIMENTAL_OPTIONS` environment variable set. This will ensure that any child processes of your login shell will also have the experimental options set.
185
+
::: tip Live on the edge
186
+
If you want to have all available experimental options on, rather than specifying them one by one, you can just use `all`!
187
+
:::
188
+
189
+
::: note Enabling experimental options
190
+
If you use Nushell as your default shell in your terminal emulator, simply add whatever experimental options you'd like in your terminal config.
191
+
192
+
On the other hand, if you use Nushell as your login shell, a quick (if not the most elegant) way to set this up is to put this snippet into your config (this example uses `all`):
193
+
194
+
```nushell
195
+
if $nu.is-login and $env.NU_EXPERIMENTAL_OPTIONS? != "all" {
196
+
$env.NU_EXPERIMENTAL_OPTIONS = "all"
197
+
exec $nu.current-exe
198
+
}
199
+
```
200
+
201
+
The first time your login shell runs, this snippet will relaunch it with the `NU_EXPERIMENTAL_OPTIONS` environment variable set. This will ensure that any child processes of your login shell will also have the experimental options set.
202
+
:::
201
203
202
204
#### Our first experimental option: `reorder-cell-paths`
203
205
@@ -352,59 +354,60 @@ There will of course be long deprecation period to avoid breaking existing code.
352
354
353
355
Implemented by [@Bahex] in [#16007].
354
356
355
-
> [!Tip]
356
-
> Nushell currently doesn't have a great way to disable deprecation warnings for code that might not be yours. If you have issues with integrations which are not updated with this and don't want to see the deprecation warnings, you can add a small wrapper around `get` to squelch the warnings as a workaround.
357
-
>
358
-
> **Please note that this will also disable the warnings for your own scripts!** Use this with caution.
359
-
>
360
-
> Here's a small example demonstrating the concept:
> get-builtin --optional=($optional or $ignore_errors) $cell_path ...$rest
366
-
>
367
-
> ```
368
-
>
369
-
> **To actually use this**, here is a more fully featured version with documentation and examples. You can put this in your `env.nu` to silence the warnings:
370
-
>
371
-
> <details>
372
-
> <summary>Click here to expand code</summary>
373
-
>
374
-
> ```nushell
375
-
> alias get-builtin = get
376
-
>
377
-
> # Extract data using a cell path.
378
-
> #
379
-
> # This is equivalent to using the cell path access syntax: `$env.OS` is the same as `$env | get OS`.
380
-
> #
381
-
> # If multiple cell paths are given, this will produce a list of values.
382
-
> @example "Get an item from a list" { [0 1 2] | get 1 } --result 1
383
-
> @example "Get a column from a table" { [{A: A0}] | get A } --result [A0]
384
-
> @example "Get a cell from a table" { [{A: A0}] | get 0.A } --result A0
385
-
> @example "Extract the name of the 3rd record in a list (same as `ls | $in.name.2`)" { ls | get name.2 }
386
-
> @example "Extract the name of the 3rd record in a list" { ls | get 2.name }
387
-
> @example "Getting Path/PATH in a case insensitive way" { $env | get paTH! }
388
-
> @example "Getting Path in a case sensitive way, won't work for `PATH`" { $env | get Path }
389
-
> def get [
390
-
> --optional (-o) # make all cell path members optional (returns null for missing values),
391
-
> --ignore-errors (-i) # ignore missing data (make all cell path members optional) (deprecated),
392
-
> --sensitive (-s) # get path in a case sensitive manner (deprecated),
393
-
> cell_path: cell-path # The cell path to the data.
394
-
> ...rest: cell-path # Additional cell paths.
395
-
> ]: [
396
-
> list<any> -> any,
397
-
> table -> any,
398
-
> record -> any,
399
-
> nothing -> nothing
400
-
> ] {
401
-
> get-builtin --optional=($optional or $ignore_errors) --sensitive=$sensitive $cell_path ...$rest
402
-
> }
403
-
> ```
404
-
>
405
-
> </details>
406
-
>
407
-
> _This workaround was inspired by [@JoaquinTrinanes]'s [similar workaround](https://github.com/nix-community/home-manager/pull/7490). Thanks for the inspiration!_
357
+
::: tip
358
+
Nushell currently doesn't have a great way to disable deprecation warnings for code that might not be yours. If you have issues with integrations which are not updated with this and don't want to see the deprecation warnings, you can add a small wrapper around `get` to squelch the warnings as a workaround.
359
+
360
+
**Please note that this will also disable the warnings for your own scripts!** Use this with caution.
get-builtin --optional=($optional or $ignore_errors) $cell_path ...$rest
368
+
369
+
```
370
+
371
+
**To actually use this**, here is a more fully featured version with documentation and examples. You can put this in your `env.nu` to silence the warnings:
372
+
373
+
<details>
374
+
<summary>Click here to expand code</summary>
375
+
376
+
```nushell
377
+
alias get-builtin = get
378
+
379
+
# Extract data using a cell path.
380
+
#
381
+
# This is equivalent to using the cell path access syntax: `$env.OS` is the same as `$env | get OS`.
382
+
#
383
+
# If multiple cell paths are given, this will produce a list of values.
384
+
@example "Get an item from a list" { [0 1 2] | get 1 } --result 1
385
+
@example "Get a column from a table" { [{A: A0}] | get A } --result [A0]
386
+
@example "Get a cell from a table" { [{A: A0}] | get 0.A } --result A0
387
+
@example "Extract the name of the 3rd record in a list (same as `ls | $in.name.2`)" { ls | get name.2 }
388
+
@example "Extract the name of the 3rd record in a list" { ls | get 2.name }
389
+
@example "Getting Path/PATH in a case insensitive way" { $env | get paTH! }
390
+
@example "Getting Path in a case sensitive way, won't work for `PATH`" { $env | get Path }
391
+
def get [
392
+
--optional (-o) # make all cell path members optional (returns null for missing values),
393
+
--ignore-errors (-i) # ignore missing data (make all cell path members optional) (deprecated),
394
+
--sensitive (-s) # get path in a case sensitive manner (deprecated),
395
+
cell_path: cell-path # The cell path to the data.
396
+
...rest: cell-path # Additional cell paths.
397
+
]: [
398
+
list<any> -> any,
399
+
table -> any,
400
+
record -> any,
401
+
nothing -> nothing
402
+
] {
403
+
get-builtin --optional=($optional or $ignore_errors) --sensitive=$sensitive $cell_path ...$rest
404
+
}
405
+
```
406
+
407
+
</details>
408
+
409
+
_This workaround was inspired by [@JoaquinTrinanes]'s [similar workaround](https://github.com/nix-community/home-manager/pull/7490). Thanks for the inspiration!_
0 commit comments