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

`inc` command seems to not exists, the only example from docs fails

Open V0ldek opened this issue 2 years ago • 8 comments

Describe the bug

The first example in the book on Pipelines contains the inc command:

> open "Cargo.toml" | inc package.version --minor | save "Cargo_new.toml"

I am trying to do exactly that with my Cargo.toml, but it fails:

〉open "Cargo.toml" | inc package.version --minor | save "Cargo_new.toml"                                                                01/21/2023 07:30:16 PM
Error: nu::shell::external_command (link)

  × External command failed
   ╭─[entry nushell/nushell#11:1:1]
 1 │ open "Cargo.toml" | inc package.version --minor | save "Cargo_new.toml"
   ·                     ─┬─
   ·                      ╰── executable was not found
   ╰────
  help: No such file or directory (os error 2)

The Cargo.toml is there, in particular getting the version behaves normally:

〉open "Cargo.toml" | get package.version
0.2.0

Moreover, which inc returns an empty list and help inc gives a Not found error:

〉help inc
Error: nu::parser::not_found (link)

  × Not found.
   ╭─[entry nushell/nushell#14:1:1]
 1 │ help inc
   ·      ─┬─
   ·       ╰── did not find anything under this name
   ╰────

How to reproduce

  1. Create any file with a semver version in it, for example by doing cargo new repro; cd repro
  2. Run open "Cargo.toml" | get package.version to verify that the file exists and has the correct field.
  3. Try running open "Cargo.toml" | inc package.version --minor.

Expected behavior

On a Cargo.toml with package version 0.1.0 the expected result would be 0.1.1.

Screenshots

image

Configuration

key value
version 0.74.0
branch
commit_hash
build_os linux-x86_64
build_target x86_64-unknown-linux-gnu
rust_version rustc 1.66.1 (90743e729 2023-01-10)
rust_channel stable-x86_64-unknown-linux-gnu
cargo_version cargo 1.66.1 (ad779e08b 2023-01-10)
pkg_version 0.74.0
build_time 2023-01-15 21:19:38 +00:00
build_rust_channel release
features database, default, trash, which, zip
installed_plugins

Additional context

No response

V0ldek avatar Jan 21 '23 19:01 V0ldek

inc is a plugin. If you're building from main, you'll have to build it with the build-all* or install-all* scripts. Then you have to register plugins.

fdncred avatar Jan 21 '23 19:01 fdncred

I installed nushell via cargo.

cargo install nu

V0ldek avatar Jan 21 '23 20:01 V0ldek

you need to install the plugins that you want to use. the ones we include in our prebuilt binaries are also on crates.io like https://crates.io/crates/nu_plugin_inc

fdncred avatar Jan 21 '23 20:01 fdncred

Thanks for that, it does work.

I guess I should just install nu through a different package manager then, I thought cargo was the safe bet, but if it doesn't have all the nooks then...

V0ldek avatar Jan 21 '23 20:01 V0ldek

you also didn't get the dataframe components which is installed with cargo install nu --feature=dataframe. the nu_plugin_query plugins can be especially helpful too for parsing web, xml, and json. There's also a good list of plugins here https://github.com/nushell/awesome-nu#plugins

fdncred avatar Jan 21 '23 20:01 fdncred

I agree with the general thrust of this issue. It's bad that we lead with examples that require plugins+installation. I think we should either rewrite the examples to use another command, or move inc into a built-in command.

I'll reopen this and move it to the docs repo.

rgwood avatar Jan 21 '23 20:01 rgwood

Is there a place where all plugins included in the binary are included?

It would be probably useful to have a single place with a cargo install command that installs nu and all the default plugins.

V0ldek avatar Jan 22 '23 17:01 V0ldek

I think all supported plugins are included in our release distributions.

fdncred avatar Jan 22 '23 22:01 fdncred