func main() { fh := gofh.Init() fh.HandleCommand("init", initProject) fh.HandleCommand("deploy", deployProject) fh.SetDefaultHandler(showUsage) fh.Parse(os.Args[1:]) }
// Ahc command line tool func main() { flagHandler := gofh.Init() serverOptions := []*gofh.Option{ &gofh.Option{Name: "port", Boolean: false}, &gofh.Option{Name: "dev", Boolean: true}, } flagHandler.HandleCommandWithOptions("server", serverOptions, StartServer) flagHandler.HandleCommand("test", TestComponents) flagHandler.Parse(os.Args[1:]) }
func main() { config, _ = ReadConfig(".") fh := gofh.Init() fh.HandleCommand("init :source", CreateConfig) fh.HandleCommand("create :name", CreateDump) fh.HandleCommand("apply :name", ApplyDump) fh.HandleCommand("rm :name", RemoveDump) fh.HandleCommand("list", ListDumps) fh.HandleCommand("list :remote", ListRemoteDumps) fh.HandleCommand("push :remote :name", PushDump) fh.HandleCommand("pull :remote :name", PullDump) fh.HandleCommand("rm :remote :name", RemoveRemoteDump) fh.SetDefaultHandler(ShowUsage) fh.Parse(os.Args[1:]) }