Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vsoch/nu-plugin
GoLang library for creating nushell plugins (under development!)
https://github.com/vsoch/nu-plugin
nu-plugin nu-plugin-golang nushell
Last synced: 26 days ago
JSON representation
GoLang library for creating nushell plugins (under development!)
- Host: GitHub
- URL: https://github.com/vsoch/nu-plugin
- Owner: vsoch
- License: mpl-2.0
- Created: 2019-10-22T19:57:27.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2019-10-24T01:53:16.000Z (about 5 years ago)
- Last Synced: 2024-06-19T16:45:42.342Z (5 months ago)
- Topics: nu-plugin, nu-plugin-golang, nushell
- Language: Go
- Size: 37.1 KB
- Stars: 5
- Watchers: 3
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Nushell Plugin in GoLang
This is a base library for generating a nushell plugin in Golang.
As nushell is under development, it's likely that not all features are implemented
here! Please [open an issue](https://www.github.com/vsoch/nu-plugin/issues)
if you need help.## Filter Plugin
I've done a basic [filter example](examples/len) to calculate the length of a string,
and the usage is summarized as follows:```go
package main
import nu "github.com/vsoch/nu-plugin/pkg/plugin"// filter will read stream from nushell and print a response
func filter(plugin *nu.FilterPlugin, params interface{}) {// can also be getIntPrimitive
value := plugin.Func.GetStringPrimitive(params)// Put your logic here! In this case, we want a length
intLength := len(value)// You must also return the tag with your response
tag := plugin.Func.GetTag(params)// This can also be printStringResponse
plugin.Func.PrintIntResponse(intLength, tag)}
func main() {
name := "len"
usage := "Return the length of a string"
plugin := nu.NewFilterPlugin(name, usage)// Run the filter function
plugin.Run(filter)
}
```For more details, see the [full example](examples/len).
## Sink Plugin
We have two examples for Sink plugins:
- [examples/salad](examples/salad) prints colored salad puns to the screen
- [examples/hello](examples/hello) is a more basic example to say hello