Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.
/ nu_plugin_len Public archive

An example plugin for `nushell` to compute length of `String`s

License

Notifications You must be signed in to change notification settings

amtoine/nu_plugin_len

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nu_plugin_len

An example plugin for nushell to compute length of Strings

📦 change the path to the dependencies

Warning
because all the dependencies for this plugin are not on crates.io, but rather only in the source of nushell, the path to all these dependencies, i.e. nu-plugin and nu-protocol are hardcoded to the nushell 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
check git diff Cargo.toml to see the change 😉

📂 install the plugin

  • 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 the register above because my CARGO_HOME is set to ($env.XDG_DATA_HOME | path join "cargo"), i.e. ~/.local/share/cargo, in my env.nu

⚙️ use the plugin

> "this is an example string" | len
25

📜 documentation

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

About

An example plugin for `nushell` to compute length of `String`s

Topics

Resources

License

Stars

Watchers

Forks