(cli *cli)
| 1042 | } |
| 1043 | |
| 1044 | func showInvitationOrganizationCmd(cli *cli) *cobra.Command { |
| 1045 | var inputs struct { |
| 1046 | OrgID string |
| 1047 | InvitationID string |
| 1048 | } |
| 1049 | |
| 1050 | cmd := &cobra.Command{ |
| 1051 | Use: "show", |
| 1052 | Args: cobra.NoArgs, |
| 1053 | Short: "Show an organization invitation", |
| 1054 | Long: "Display information about an organization invitation.\n\n" + |
| 1055 | "To show interactively, use `auth0 orgs invs show` with no flags.\n\n" + |
| 1056 | "To show non-interactively, supply the organization id and invitation id through the flags.", |
| 1057 | Example: ` auth0 orgs invs show |
| 1058 | auth0 orgs invs show --org-id <org-id> |
| 1059 | auth0 orgs invs show --org-id <org-id> --invitation-id <invitation-id> |
| 1060 | auth0 orgs invs show --org-id <org-id> --invitation-id <invitation-id> --json |
| 1061 | auth0 orgs invs show --org-id <org-id> --i <invitation-id> --json-compact`, |
| 1062 | RunE: func(cmd *cobra.Command, args []string) error { |
| 1063 | if err := organizationIDFlag.Pick(cmd, &inputs.OrgID, cli.organizationPickerOptions); err != nil { |
| 1064 | return err |
| 1065 | } |
| 1066 | |
| 1067 | if err := invitationID.Pick(cmd, &inputs.InvitationID, func(ctx context.Context) (pickerOptions, error) { |
| 1068 | return cli.invitationPickerOptions(ctx, inputs.OrgID) |
| 1069 | }); err != nil { |
| 1070 | return err |
| 1071 | } |
| 1072 | |
| 1073 | var invitation *management.OrganizationInvitation |
| 1074 | if err := ansi.Waiting(func() (err error) { |
| 1075 | invitation, err = cli.api.Organization.Invitation(cmd.Context(), inputs.OrgID, inputs.InvitationID) |
| 1076 | return err |
| 1077 | }); err != nil { |
| 1078 | return fmt.Errorf("failed to read organization invitation %q: %w", inputs.InvitationID, err) |
| 1079 | } |
| 1080 | |
| 1081 | cli.renderer.InvitationsShow(*invitation) |
| 1082 | return nil |
| 1083 | }, |
| 1084 | } |
| 1085 | |
| 1086 | organizationIDFlag.RegisterString(cmd, &inputs.OrgID, "") |
| 1087 | invitationID.RegisterString(cmd, &inputs.InvitationID, "") |
| 1088 | cmd.Flags().BoolVar(&cli.json, "json", false, "Output in json format.") |
| 1089 | cmd.Flags().BoolVar(&cli.jsonCompact, "json-compact", false, "Output in compact json format.") |
| 1090 | |
| 1091 | return cmd |
| 1092 | } |
| 1093 | |
| 1094 | func listInvitationsOrganizationCmd(cli *cli) *cobra.Command { |
| 1095 | var inputs struct { |
no test coverage detected