MCPcopy Create free account
hub / github.com/cronitorio/cronitor-cli / validateName

Function validateName

cmd/discover.go:660–675  ·  view source on GitHub ↗
(candidateName string)

Source from the content-addressed store, hash-verified

658}
659
660func validateName(candidateName string) error {
661 candidateName = strings.TrimSpace(candidateName)
662 if candidateName == "" {
663 return errors.New("A unique name is required")
664 }
665
666 if existingMonitors.HasMonitorByName(candidateName) {
667 return errors.New("Sorry, you already have a monitor with this name. A unique name is required")
668 }
669
670 if inputLen := len(candidateName); inputLen > maxNameLen {
671 return errors.New(fmt.Sprintf("Sorry, name is too long: %d of maximum %d chars", inputLen, maxNameLen))
672 }
673
674 return nil
675}
676
677type item struct {
678 title, desc string

Callers 1

UpdateMethod · 0.85

Calls 1

HasMonitorByNameMethod · 0.80

Tested by

no test coverage detected