30 lines
769 B
Go
30 lines
769 B
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{}, "auth")
|
|
subcommands.Register(&whoamiCmd{}, "auth")
|
|
subcommands.ImportantFlag("api-server")
|
|
subcommands.ImportantFlag("config")
|
|
|
|
flag.Parse()
|
|
ctx := context.Background()
|
|
os.Exit(int(subcommands.Execute(ctx)))
|
|
}
|