char/plugins/gocli/main.go

48 lines
957 B
Go
Raw Normal View History

2022-11-01 14:26:54 +01:00
package main
import (
"context"
"log"
"git.front.kjuulh.io/kjuulh/char/pkg/register"
2022-11-05 23:25:19 +01:00
"github.com/hashicorp/go-hclog"
2022-11-01 14:26:54 +01:00
)
2022-11-02 16:31:12 +01:00
type GoCliPlugin struct{}
2022-11-01 14:26:54 +01:00
2022-11-05 23:05:41 +01:00
// Do implements register.Plugin
2022-11-05 23:20:06 +01:00
func (*GoCliPlugin) Do(ctx context.Context, cmd *register.DoCommand) error {
2022-11-05 23:31:31 +01:00
hclog.L().Info("received command", "commandName", cmd.CommandName)
2022-11-05 23:20:59 +01:00
return nil
2022-11-05 23:05:41 +01:00
}
2022-11-01 21:15:32 +01:00
func (*GoCliPlugin) About(ctx context.Context) (*register.About, error) {
return &register.About{
Name: "gocli",
Version: "v0.0.1",
About: "golang cli provides a set of actions and presets supporting golang development",
2022-11-02 22:10:15 +01:00
Vars: []string{
"dev.mode",
},
Commands: []*register.AboutCommand{
{
Name: "local_up",
Args: []string{"fish"},
Required: []string{"fish"},
},
},
2022-11-01 21:15:32 +01:00
}, nil
2022-11-01 14:26:54 +01:00
}
var _ register.Plugin = &GoCliPlugin{}
func main() {
if err := register.
NewPluginBuilder(
&GoCliPlugin{},
).
Serve(context.Background()); err != nil {
log.Fatal(err)
}
}