Esempio n. 1
0
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())
}
Esempio n. 2
0
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())
}