func list(cmd *cobra.Command, args []string) { c := cli.NewClient(server) guests := []cli.JMap{} if len(args) == 0 { if termutil.Isatty(os.Stdin.Fd()) { guests = getGuests(c) sort.Sort(cli.JMapSlice(guests)) } else { args = cli.Read(os.Stdin) } } if len(guests) == 0 { for _, id := range args { cli.AssertID(id) guests = append(guests, getGuest(c, id)) } } for _, guest := range guests { guest.Print(jsonout) } }
func list(cmd *cobra.Command, args []string) { c := cli.NewClient(server) hvs := []cli.JMap{} if len(args) == 0 { if termutil.Isatty(os.Stdin.Fd()) { hvs = getHVs(c) sort.Sort(cli.JMapSlice(hvs)) } else { args = cli.Read(os.Stdin) } } if len(hvs) == 0 { for _, id := range args { cli.AssertID(id) hvs = append(hvs, getHV(c, id)) } } for _, hv := range hvs { hv.Print(jsonout) } }
func list(cmd *cobra.Command, args []string) { c := cli.NewClient(getServerURL()) images := []cli.JMap{} if len(args) == 0 { if termutil.Isatty(os.Stdin.Fd()) { images = getImages(c) sort.Sort(cli.JMapSlice(images)) } else { args = cli.Read(os.Stdin) } } if len(images) == 0 { for _, id := range args { cli.AssertID(id) image, _ := c.Get("image", "images/"+id) images = append(images, image) } } for _, image := range images { image.Print(jsonout) } }