github.com/naphatkrit/deis@v1.12.3/client/cmd/users.go (about)

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