Skip to content

feat(cli): validate name length on template create #3823

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

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat(cli): add name validation to templatecreate
This adds a validation step to ensure the template name is less than 32
characters.
  • Loading branch information
jsjoeio committed Sep 2, 2022
commit cfb2f408c19a56e5c233c825887d08149fc3270c
4 changes: 4 additions & 0 deletions cli/templatecreate.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ func templateCreate() *cobra.Command {
templateName = args[0]
}

if len(templateName) > 31 {
return xerrors.Errorf("Template name must be less than 32 characters")
}

_, err = client.TemplateByName(cmd.Context(), organization.ID, templateName)
if err == nil {
return xerrors.Errorf("A template already exists named %q!", templateName)
Expand Down