func apps(c *cli.Context) { repo := host.GetAppRepo() apps, err := repo.List() if err != nil { fatal(err) } tbl := table.New(2) for _, app := range apps { tbl.Add(app.Name, app.ID) } fmt.Println("=== Apps") fmt.Print(tbl.String()) }
func createApp(c *cli.Context) { name := c.Args()[0] if name == "" { fatal("Must specify name") } app := &api.App{ Name: name, } repo := host.GetAppRepo() if err := repo.Create(app); err != nil { fatal(err) } tbl := table.New(2) tbl.Add("ID:", app.ID) fmt.Println("=== App " + app.Name) fmt.Print(tbl.String()) }