Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Jiehong opened this issue Oct 5, 2023 · 1 comment
Open

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

Jiehong opened this issue Oct 5, 2023 · 1 comment
Labels
documentation Improvements or additions to documentation

Comments

@Jiehong
Copy link

Jiehong commented Oct 5, 2023

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 Jiehong added the question Further information is requested label Oct 5, 2023
@fdncred fdncred added documentation Improvements or additions to documentation and removed question Further information is requested labels Oct 5, 2023
@fdncred
Copy link
Collaborator

fdncred commented Oct 5, 2023

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

@fdncred fdncred transferred this issue from nushell/nushell Oct 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants