Files
mesh-catalog/modules/claude-licence-manager/internal/licences/keyform.go
T
jschoubben cff1005422
mesh/delivery merged: source.main moved to novox/mesh-catalog@6d000647de2d
mesh/check being carried to cff1005422c1 on 6d000647de2d | from f9dcbc295723
P2: the licence manager is four parts of one manifest (issue 1409)
The one bundle that did everything becomes the manager bundle, which runs long and answers the seat's ten verbs and
the three acting tools, and a tools bundle of its own that answers the four reading tools and writes nothing, so they
answer while the manager fails to load or stops. Both import the module's one package for the layouts of the kept
data and the log entries, the key form, the entries' names and the settings with their validity; the settings file
and the account with its directory stay as they are.

Builds: design 39 parts §1, §2, §3, §4, §5, §6, §7, §8
2026-11-12 12:08:03 +01:00

24 lines
664 B
Go

package licences
// A licence's key form (design 39 bus-and-switch §10, B6): the name every verb and tool takes and answers, written
// in the characters a key of the bus takes.
import "strings"
// KeyFor is a licence's key: its name in lower case, each `@` written as `_at_`, and every other character
// outside letters, digits, `-` and `.` written as `_`.
func KeyFor(name string) string {
var b strings.Builder
for _, r := range strings.ToLower(name) {
switch {
case r == '@':
b.WriteString("_at_")
case r >= 'a' && r <= 'z', r >= '0' && r <= '9', r == '-', r == '.':
b.WriteRune(r)
default:
b.WriteByte('_')
}
}
return b.String()
}