func main() { subcommands.Register(subcommands.HelpCommand(), "") subcommands.Register(subcommands.FlagsCommand(), "") subcommands.Register(subcommands.CommandsCommand(), "") subcommands.Register(&serveCmd{}, "") flag.Parse() ctx := context.Background() os.Exit(int(subcommands.Execute(ctx))) }
func main() { subcommands.Register(subcommands.HelpCommand(), "") subcommands.Register(subcommands.FlagsCommand(), "") subcommands.Register(subcommands.CommandsCommand(), "") subcommands.Register(&commands.DiscoverCmd{}, "discover") subcommands.Register(&commands.TuiCmd{}, "tui") subcommands.Register(&commands.ScanCmd{}, "scan") subcommands.Register(&commands.PrepareCmd{}, "prepare") subcommands.Register(&commands.HistoryCmd{}, "history") var v = flag.Bool("v", false, "Show version") flag.Parse() if *v { fmt.Printf("%s %s\n", version.Name, version.Version) os.Exit(int(subcommands.ExitSuccess)) } ctx := context.Background() os.Exit(int(subcommands.Execute(ctx))) }