wasmcloud/cmd/wasmcloud/main.go

32 lines
855 B
Go
Raw Normal View History

2019-11-19 17:07:56 +00:00
package main
import (
2019-12-08 14:27:42 +00:00
"context"
2019-11-19 17:07:56 +00:00
"flag"
2019-12-08 14:27:42 +00:00
"os"
"path/filepath"
2019-11-19 17:07:56 +00:00
2019-12-08 14:27:42 +00:00
"github.com/google/subcommands"
2019-11-19 17:07:56 +00:00
)
var (
2019-12-08 14:27:42 +00:00
apiServer = flag.String("api-server", "http://wasmcloud.kahless.cetacean.club:3002", "default API server")
configLocation = flag.String("config", filepath.Join(os.Getenv("HOME"), ".wasmc.json"), "default config location")
2019-11-19 17:07:56 +00:00
)
func main() {
2019-12-08 14:27:42 +00:00
subcommands.Register(subcommands.HelpCommand(), "")
subcommands.Register(subcommands.FlagsCommand(), "")
subcommands.Register(subcommands.CommandsCommand(), "")
subcommands.Register(&loginCmd{}, "")
subcommands.Register(&whoamiCmd{}, "")
2019-12-08 16:07:31 +00:00
subcommands.Register(namegenCmd{}, "util")
subcommands.Register(&testWorkCommand{}, "util")
2019-12-08 14:27:42 +00:00
subcommands.ImportantFlag("api-server")
subcommands.ImportantFlag("config")
2019-11-19 17:07:56 +00:00
2019-12-08 14:27:42 +00:00
flag.Parse()
ctx := context.Background()
os.Exit(int(subcommands.Execute(ctx)))
2019-11-19 17:07:56 +00:00
}