-
Notifications
You must be signed in to change notification settings - Fork 5
/
main.go
46 lines (36 loc) · 1.05 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package main
import (
"context"
"os"
hplugin "github.com/hashicorp/go-plugin"
"github.com/ignite/cli/ignite/services/plugin"
"github.com/ignite/cli-plugin-airdrop/cmd"
)
type app struct{}
func (app) Manifest(context.Context) (*plugin.Manifest, error) {
m := &plugin.Manifest{Name: "airdrop"}
m.ImportCobraCommand(cmd.NewAirdrop(), "ignite")
return m, nil
}
func (app) Execute(_ context.Context, c *plugin.ExecutedCommand, _ plugin.ClientAPI) error {
os.Args = c.OsArgs[1:]
return cmd.NewAirdrop().Execute()
}
func (app) ExecuteHookPre(context.Context, *plugin.ExecutedHook, plugin.ClientAPI) error {
return nil
}
func (app) ExecuteHookPost(context.Context, *plugin.ExecutedHook, plugin.ClientAPI) error {
return nil
}
func (app) ExecuteHookCleanUp(context.Context, *plugin.ExecutedHook, plugin.ClientAPI) error {
return nil
}
func main() {
hplugin.Serve(&hplugin.ServeConfig{
HandshakeConfig: plugin.HandshakeConfig(),
Plugins: map[string]hplugin.Plugin{
"airdrop": plugin.NewGRPC(&app{}),
},
GRPCServer: hplugin.DefaultGRPCServer,
})
}