Skip to content
Snippets Groups Projects
Commit b576815d authored by Mark van Holsteijn's avatar Mark van Holsteijn
Browse files

fix: duration can only be in hours

parent 86715953
No related branches found
No related tags found
3 merge requests!1643feat: rotate personal, project or group access tokens,!1642feat: list personal, project or group access tokens,!1641feat: revoke personal, project and group access tokens
This commit is part of merge request !1643. Comments created here will be created in the context of that merge request.
......@@ -125,7 +125,7 @@ func NewCmdCreate(f *cmdutils.Factory, runE func(opts *CreateOptions) error) *co
cmdutils.EnableRepoOverride(cmd, f)
cmd.Flags().StringVarP(&opts.Group, "group", "g", "", "Create a group access token. Ignored if a user or repository argument is set.")
cmd.Flags().StringVarP(&opts.User, "user", "U", "", "Create a personal access token. For the current user, use @me.")
cmd.Flags().DurationVarP(&opts.Duration, "duration", "D", time.Duration(30*24*time.Hour), "Sets the token duration, in hours. Maximum of 8760. Examples: 24h, 168h, 504w.")
cmd.Flags().DurationVarP(&opts.Duration, "duration", "D", time.Duration(30*24*time.Hour), "Sets the token duration, in hours. Maximum of 8760. Examples: 24h, 168h, 504h.")
cmd.Flags().VarP(&opts.ExpireAt, "expires-at", "E", "Sets the token's expiration date and time, in YYYY-MM-DD format. If not specified, --duration is used.")
cmd.Flags().StringSliceVarP(&opts.Scopes, "scope", "S", []string{"read_repository"}, "Scopes for the token. For a list, see https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html#personal-access-token-scopes.")
cmd.Flags().VarP(&opts.AccessLevel, "access-level", "A", "Access level of the token: one of 'guest', 'reporter', 'developer', 'maintainer', 'owner'.")
......
......@@ -62,7 +62,7 @@ glab token create --user johndoe --scope api johns-personal-token
```plaintext
-A, --access-level AccessLevel Access level of the token: one of 'guest', 'reporter', 'developer', 'maintainer', 'owner'. (default no)
-D, --duration duration Sets the token duration, in hours. Maximum of 8760. Examples: 24h, 168h, 504w. (default 720h0m0s)
-D, --duration duration Sets the token duration, in hours. Maximum of 8760. Examples: 24h, 168h, 504h. (default 720h0m0s)
-E, --expires-at DATE Sets the token's expiration date and time, in YYYY-MM-DD format. If not specified, --duration is used. (default 0001-01-01)
-g, --group string Create a group access token. Ignored if a user or repository argument is set.
-F, --output string Format output as 'text' for the token value, 'json' for the actual API token structure. (default "text")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment