-
Notifications
You must be signed in to change notification settings - Fork 5
/
main.go
46 lines (40 loc) · 1.73 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 (
_ "embed"
"os"
"strings"
"github.com/extism/cli"
"github.com/spf13/cobra"
)
var banner string = `
███████╗██╗░░██╗████████╗██╗░██████╗███╗░░░███╗
██╔════╝╚██╗██╔╝╚══██╔══╝██║██╔════╝████╗░████║
█████╗░░░╚███╔╝░░░░██║░░░██║╚█████╗░██╔████╔██║
██╔══╝░░░██╔██╗░░░░██║░░░██║░╚═══██╗██║╚██╔╝██║
███████╗██╔╝╚██╗░░░██║░░░██║██████╔╝██║░╚═╝░██║
╚══════╝╚═╝░░╚═╝░░░╚═╝░░░╚═╝╚═════╝░╚═╝░░░░░╚═╝
`
//go:embed VERSION
var version string
func rootCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "extism",
Version: strings.TrimSpace(version),
Long: banner,
Short: "A CLI for Extism, https://extism.org",
}
cmd.PersistentFlags().BoolVarP(&cli.LoggingEnabled, "verbose", "v", false, "Enable additional logging")
cmd.PersistentFlags().BoolVarP(&cli.PrintingDisabled, "quiet", "q", false, "Suppress output")
cmd.PersistentFlags().StringVar(&cli.GithubToken, "github-token", os.Getenv("GITHUB_TOKEN"),
"Github access token, can also be set using the $GITHUB_TOKEN env variable")
cmd.AddCommand(cli.CallCmd())
cmd.AddCommand(cli.LibCmd())
cmd.AddCommand(cli.GenerateCmd())
return cmd
}
func main() {
err := rootCmd().Execute()
if err != nil {
os.Exit(1)
}
}