Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: pass in optional role flag when using members invite #90

Merged

Conversation

k3llymariee
Copy link
Contributor

Adds an optional flag for the members invite command to pass in a built-in role that will apply to all members invited. Default value is reader.

☁  ⚡  go run main.go members invite --help
Invite new members

Usage:
  ldcli members invite [flags]

Flags:
  -e, --emails strings   A comma separated list of emails
  -h, --help             help for invite
  -r, --role string      Built-in role for the member - one of reader, writer, or admin (default "reader")

Global Flags:
      --api-token string   LaunchDarkly API token
      --base-uri string    LaunchDarkly base URI (default "https://app.launchdarkly.com")

Copy link

This pull request has been linked to Shortcut Story #238446: pass in option --role/-r flag for invite members command.

@@ -33,6 +33,19 @@ func NewInviteCmd(client members.Client) (*cobra.Command, error) {
return nil, err
}

var role string
cmd.Flags().StringVarP(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be StringP instead if we don't need the local role var?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indeed!

@@ -85,3 +85,59 @@ func TestInvite(t *testing.T) {
assert.EqualError(t, err, "base-uri is invalid"+errorHelp)
})
}

func TestInviteWithOptionalRole(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a blocker, but you could probably make these subtests of TestInvite.

@k3llymariee k3llymariee merged commit b51470d into main Mar 28, 2024
2 checks passed
@k3llymariee k3llymariee deleted the kelly/sc-238446/pass-in-option-role-flag-for-invite-members branch March 28, 2024 23:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants