40 lines
1.0 KiB
Go
40 lines
1.0 KiB
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"flag"
|
|
"os"
|
|
"path/filepath"
|
|
|
|
"github.com/google/subcommands"
|
|
)
|
|
|
|
var (
|
|
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")
|
|
)
|
|
|
|
func main() {
|
|
subcommands.Register(subcommands.HelpCommand(), "")
|
|
subcommands.Register(subcommands.FlagsCommand(), "")
|
|
subcommands.Register(subcommands.CommandsCommand(), "")
|
|
|
|
subcommands.Register(&loginCmd{}, "api")
|
|
subcommands.Register(&whoamiCmd{}, "api")
|
|
|
|
subcommands.Register(&handlerCreateCmd{}, "handlers")
|
|
subcommands.Register(&handlerListCmd{}, "handlers")
|
|
subcommands.Register(&handlerLogsCmd{}, "handlers")
|
|
subcommands.Register(&handlerInvokeCmd{}, "handlers")
|
|
|
|
subcommands.Register(namegenCmd{}, "utils")
|
|
subcommands.Register(&runCmd{}, "utils")
|
|
|
|
subcommands.ImportantFlag("api-server")
|
|
subcommands.ImportantFlag("config")
|
|
|
|
flag.Parse()
|
|
ctx := context.Background()
|
|
os.Exit(int(subcommands.Execute(ctx)))
|
|
}
|