-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathusers.go
More file actions
48 lines (38 loc) · 813 Bytes
/
users.go
File metadata and controls
48 lines (38 loc) · 813 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package parser
import (
"fmt"
"github.com/deis/deis/client-go/cmd"
docopt "github.com/docopt/docopt-go"
)
// Users routes user commands to the specific function.
func Users(argv []string) error {
usage := `
Valid commands for users:
users:list list all registered users
Use 'deis help [command]' to learn more.
`
if len(argv) < 2 {
return usersList([]string{"users:list"})
}
switch argv[1] {
case "list":
return usersList(combineCommand(argv))
case "--help":
fmt.Print(usage)
return nil
default:
PrintUsage()
return nil
}
}
func usersList(argv []string) error {
usage := `
Lists all registered users.
Requires admin privilages.
Usage: deis users:list
`
if _, err := docopt.Parse(usage, argv, true, "", false, true); err != nil {
return err
}
return cmd.UsersList()
}