2021-08-28 13:44:41 +02:00
|
|
|
package cmd
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"github.com/ansible-semaphore/semaphore/db"
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
userCmd.AddCommand(userListCmd)
|
|
|
|
}
|
|
|
|
|
|
|
|
var userListCmd = &cobra.Command{
|
|
|
|
Use: "list",
|
|
|
|
Short: "Print all users",
|
|
|
|
Run: func(cmd *cobra.Command, args []string) {
|
2022-11-09 17:30:35 +01:00
|
|
|
store := createStore("")
|
|
|
|
defer store.Close("")
|
2021-08-28 13:44:41 +02:00
|
|
|
|
|
|
|
users, err := store.GetUsers(db.RetrieveQueryParams{})
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, user := range users {
|
|
|
|
fmt.Println(user.Username)
|
|
|
|
}
|
|
|
|
},
|
2022-11-09 17:30:35 +01:00
|
|
|
}
|