~hduran-8/+junk/caddylegacy

« back to all changes in this revision

Viewing changes to debian/gocode/src/github.com/JamesClonk/vultr/cmd/commands_regions.go

  • Committer: Horacio Durán
  • Date: 2016-10-14 14:33:43 UTC
  • Revision ID: horacio.duran@canonical.com-20161014143343-ytyhz5sx7d1cje4q
Added new upstream version

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
package cmd
2
 
 
3
 
import (
4
 
        "fmt"
5
 
        "log"
6
 
 
7
 
        "github.com/jawher/mow.cli"
8
 
)
9
 
 
10
 
func regionList(cmd *cli.Cmd) {
11
 
        cmd.Action = func() {
12
 
                regions, err := GetClient().GetRegions()
13
 
                if err != nil {
14
 
                        log.Fatal(err)
15
 
                }
16
 
 
17
 
                if len(regions) == 0 {
18
 
                        fmt.Println()
19
 
                        return
20
 
                }
21
 
 
22
 
                lengths := []int{8, 48, 24, 8, 8}
23
 
                tabsPrint(Columns{"DCID", "NAME", "CONTINENT", "COUNTRY", "STATE"}, lengths)
24
 
                for _, region := range regions {
25
 
                        tabsPrint(Columns{region.ID, region.Name, region.Continent, region.Country, region.State}, lengths)
26
 
                }
27
 
                tabsFlush()
28
 
        }
29
 
}