nushell.github.io icon indicating copy to clipboard operation
nushell.github.io copied to clipboard

[doc] add example for "update/upsert" for powershell

Open Jiehong opened this issue 2 years ago • 1 comments

Question

Not a question, nor a defect nor a feature request, but more of a documentation update.

In https://www.nushell.sh/book/nushell_map.html, there is no example of upsert/update for powershell, while there could be one.

For example, in nushell, I can write:

open Cargo.toml | update package.version 1.0.0 | save --force Cargo.toml

While I have to write the following in powershell:

Get-Content Cargo.toml | ConvertFrom-Toml | ForEach-Object {$_.package.version = "1.0.0"; $_} | ConvertTo-Toml -Depth 20

So the equivalent of update would be ForEach-Object {$_.path.to.update = "new value"; $_}.

Yes, this makes nushell even nicer :D

Additional context and details

Note that the example given uses a powershell plugin to handle TOML, but the example would be the same with a json file and without plugins.

Jiehong avatar Oct 05 '23 09:10 Jiehong

Thanks. Feel free to add this to our documentation. I'll move this issue over to our docs repo.

fdncred avatar Oct 05 '23 11:10 fdncred

Should be closeable with #1497 committed - Thanks!

NotTheDr01ds avatar Aug 07 '24 00:08 NotTheDr01ds