wasmcloud/cmd/wasmcloud/main.go

41 lines
1.1 KiB
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(), "")
2019-12-10 23:57:07 +00:00
2019-12-08 17:46:02 +00:00
subcommands.Register(&loginCmd{}, "api")
subcommands.Register(&whoamiCmd{}, "api")
2019-12-10 23:57:07 +00:00
2019-12-08 19:13:36 +00:00
subcommands.Register(&handlerCreateCmd{}, "handlers")
2019-12-13 04:55:20 +00:00
subcommands.Register(&handlerDeleteCmd{}, "handlers")
2019-12-10 23:57:07 +00:00
subcommands.Register(&handlerListCmd{}, "handlers")
2019-12-10 22:25:41 +00:00
subcommands.Register(&handlerLogsCmd{}, "handlers")
2019-12-10 23:57:07 +00:00
subcommands.Register(&handlerInvokeCmd{}, "handlers")
2019-12-08 17:46:02 +00:00
subcommands.Register(namegenCmd{}, "utils")
subcommands.Register(&runCmd{}, "utils")
2019-12-10 23:57:07 +00:00
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
}