/
invites.go
66 lines (64 loc) · 1.81 KB
/
invites.go
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package cmd
import "github.com/urfave/cli"
func init() {
invites := cli.Command{
Name: "invites",
Usage: "View and accept organization invites",
Category: "ORGANIZATIONS",
Subcommands: []cli.Command{
{
Name: "send",
Usage: "Send an invitation to join an organization to an email address",
ArgsUsage: "<email>",
Flags: []cli.Flag{
orgFlag("org to invite user to", true),
newSlicePlaceholder("team, t", "TEAM", "team to add user to", "member", "", true),
},
Action: chain(
ensureDaemon, ensureSession, loadDirPrefs, loadPrefDefaults,
setSliceDefaults, checkRequiredFlags, invitesSend,
),
},
{
Name: "list",
Usage: "List outstanding invitations for an organization. These invites have yet to be approved.",
Flags: []cli.Flag{
orgFlag("org to list invites for", false),
cli.BoolFlag{
Name: "approved, a",
Usage: "Show only approved invites",
},
},
Action: chain(
ensureDaemon, ensureSession, loadDirPrefs, loadPrefDefaults,
checkRequiredFlags, invitesList,
),
},
{
Name: "approve",
Usage: "Approve an invitation previously sent to an email address to join an organization",
ArgsUsage: "<email>",
Flags: []cli.Flag{
orgFlag("org to approve invite for", true),
},
Action: chain(
ensureDaemon, ensureSession, loadDirPrefs,
loadPrefDefaults, checkRequiredFlags, invitesApprove,
),
},
{
Name: "accept",
Usage: "Accept an invitation to join an organization",
ArgsUsage: "<email> <code>",
Flags: []cli.Flag{
orgFlag("org to accept invite for", true),
},
Action: chain(
ensureDaemon, loadDirPrefs,
loadPrefDefaults, checkRequiredFlags, invitesAccept,
),
},
},
}
Cmds = append(Cmds, invites)
}