This template is intended to be used with cargo-generate in order to quickly bootstrap nushell plugin projects.
You must run cargo generate
with --force
.
> cargo generate --force --git https://github.com/nushell/nu_plugin_template
🤷 What will this plugin be named?: foo
Creating a new plugin named "foo"
Your plugin crate will be named "nu_plugin_foo".
Note that the MIT license is used by default, to reflect the majority of
Nushell projects. You can change this manually if you'd like to.
!!! IMPORTANT !!!
You must run cargo generate with --force, or it will rename your project to
something that is non-standard for Nushell plugins and this will fail.
If you see a message after this about renaming your project, please abort and
try again with --force.
🔧 Destination: /var/home/devyn/Projects/nushell/nu_plugin_foo ...
🔧 project-name: nu_plugin_foo ...
🔧 Generating template ...
🤷 What should your first command be called? (spaces are okay): foo
✔ 🤷 Do you intend to create more than one command / subcommand? · No
✔ 🤷 Would you like a simple command? Say no if you would like to use streaming. · Yes
🤷 What is your GitHub username? (Leave blank if you don't want to publish to GitHub) [default: ]:
🔧 Moving generated files into: `/var/home/devyn/Projects/nushell/nu_plugin_foo`...
🔧 Initializing a fresh Git repository
✨ Done! New project created /var/home/devyn/Projects/nushell/nu_plugin_foo
> cd nu_plugin_foo
> cargo build
> plugin add target/debug/nu_plugin_foo
> plugin use foo
> foo Ellie
Hello, Ellie. How are you today?
-
plugin_name
- all nushell plugins are binaries with the name formatnu_plugin_SOMETHING
. This is how nushell discovers them. You need to tell this generator what thatSOMETHING
is. If you enterrandom
as the plugin name, your binary will be callednu_plugin_random
. -
command_name
- the name of your first/only command. This can be any valid nushell command name, and can contain spaces. For example, if you're creating a format plugin forFORMAT
files, you might choose to go withfrom FORMAT
orto FORMAT
. -
multi_commmand
- set toYes
if you expect that you'll be creating more than one command, in which case we'll create acommands
module for you and put the command in there. Set toNo
if you would rather just have everything insrc/main.rs
. -
command_is_simple
- set toYes
if you want aSimplePluginCommand
with no streaming support, orNo
if you wantPluginCommand
with a streaming example. -
github_username
- we'll use this to set the repository field inCargo.toml
if you set it.