github.com/chasestarr/deis@v1.13.5-0.20170519182049-1d9e59fbdbfc/client/cmd/users.go (about) 1 package cmd 2 3 import ( 4 "fmt" 5 "sort" 6 7 "github.com/deis/deis/client/controller/client" 8 "github.com/deis/deis/client/controller/models/users" 9 ) 10 11 // UsersList lists users registered with the controller. 12 func UsersList(results int) error { 13 c, err := client.New() 14 15 if err != nil { 16 return err 17 } 18 19 if results == defaultLimit { 20 results = c.ResponseLimit 21 } 22 23 users, count, err := users.List(c, results) 24 25 if err != nil { 26 return err 27 } 28 29 fmt.Printf("=== Users%s", limitCount(len(users), count)) 30 31 sort.Sort(users) 32 33 for _, user := range users { 34 fmt.Println(user.Username) 35 } 36 return nil 37 }