Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nushell/nu_plugin_template
https://github.com/nushell/nu_plugin_template
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/nushell/nu_plugin_template
- Owner: nushell
- License: mit
- Created: 2022-12-18T22:14:02.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-22T13:09:34.000Z (5 months ago)
- Last Synced: 2024-10-20T12:52:07.243Z (3 months ago)
- Language: Rust
- Size: 41 KB
- Stars: 12
- Watchers: 2
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-nu - nu_plugin_template - generate` template for making it easier to create nushell plugins. (Plugins)
README
# nu_plugin_template
This template is intended to be used with [cargo-generate](https://github.com/cargo-generate/cargo-generate) in order to quickly bootstrap nushell plugin projects.
You must run `cargo generate` with `--force`.
## Usage:
```
> 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?
```## Config values
- `plugin_name` - all nushell plugins are binaries with the name format
`nu_plugin_SOMETHING`. This is how nushell discovers them. You need to tell this
generator what that `SOMETHING` is. If you enter `random` as the plugin name,
your binary will be called `nu_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 for `FORMAT` files, you
might choose to go with `from FORMAT` or `to FORMAT`.- `multi_commmand` - set to `Yes` if you expect that you'll be creating more than one command, in
which case we'll create a `commands` module for you and put the command in there. Set to `No` if you
would rather just have everything in `src/main.rs`.- `command_is_simple` - set to `Yes` if you want a `SimplePluginCommand` with no streaming support,
or `No` if you want `PluginCommand` with a streaming example.- `github_username` - we'll use this to set the repository field in `Cargo.toml` if you set it.