func (u *UserCommand) List(client *auth.TunClient) error {
	users, err := client.GetUsers()
	if err != nil {
		return trace.Wrap(err)
	}
	usersView := func(users []services.User) string {
		t := goterm.NewTable(0, 10, 5, ' ', 0)
		printHeader(t, []string{"User", "Allowed to login as"})
		if len(users) == 0 {
			return t.String()
		}
		for _, u := range users {
			fmt.Fprintf(t, "%v\t%v\n", u.GetName(), strings.Join(u.GetAllowedLogins(), ","))
		}
		return t.String()
	}
	fmt.Printf(usersView(users))
	return nil
}
// List prints all existing user accounts
List prints all existing user accounts
// List prints all existing user accounts
func (u *UserCommand) List(client *auth.TunClient) error {
	users, err := client.GetUsers()
	if err != nil {
		return trace.Wrap(err)
	}
	usersView := func(users []services.User) string {
		t := goterm.NewTable(0, 10, 5, ' ', 0)
		printHeader(t, []string{"User", "Allowed to login as"})
		if len(users) == 0 {
			return t.String()
		}
		for _, u := range users {
			fmt.Fprintf(t, "%v\t%v\n", u.GetName(), strings.Join(u.GetAllowedLogins(), ","))
		}
		return t.String()
	}
	fmt.Printf(usersView(users))
	return nil
}
func ( u * UserCommand ) List ( client * auth . TunClient ) error { users , err := client . GetUsers ( ) if err != nil { return trace . Wrap ( err ) } usersView := func ( users [ ] services . User ) string { t := goterm . NewTable ( 0 , 10 , 5 , ' ' , 0 ) printHeader ( t , [ ] string { " " , " " } ) if len ( users ) == 0 { return t . String ( ) } for _ , u := range users { fmt . Fprintf ( t , " \t \n " , u . GetName ( ) , strings . Join ( u . GetAllowedLogins ( ) , " " ) ) } return t . String ( ) } fmt . Printf ( usersView ( users ) ) return nil }
List prints all existing user accounts
List prints all existing user accounts