An example plugin for nushell
to compute length of String
s
Warning
because all the dependencies for this plugin are not on crates.io, but rather only in the source ofnushell
, the path to all these dependencies, i.e.nu-plugin
andnu-protocol
are hardcoded to thenushell
source on my machine.even though the paths do not mention
amtoine
, they still are unique to my system...
to correctly install these dependencies, which btw are not present at all in the Cargo.toml
to avoid any issues, one can (and probably should) run the following
> git clone https://github.com/nushell/nushell /path/to/nushell/
or choose another way to get the source code of nushell
somewhere locally 😋
then
> use toolkit.nu
> toolkit setup /path/to/nushell/
and voila
Note
checkgit diff Cargo.toml
to see the change 😉
- build and install the binary with
cargo install --path .
- register the plugin in
nushell
with
register /path/to/cargo/bin/nu_plugin_len
Note
for instance, i use~/.local/share/cargo/bin/nu_plugin_len
in theregister
above because myCARGO_HOME
is set to($env.XDG_DATA_HOME | path join "cargo")
, i.e.~/.local/share/cargo
, in myenv.nu
> "this is an example string" | len
25
one can have a look at the documentation of the crate by going to docs/
Note
this documentation has been generated with> use toolkit.nu > toolkit doc