cmd, templates, integration: extract shared production constants

Constants the operator/test reader benefits from centralising.
Tests stay verbatim (the .golangci.yaml goconst tune skips them);
extraction here applies only where the same literal acts as
shared vocabulary across files.

  cmd/headscale/cli/strings.go (new)
    Cobra subcommand verbs and aliases shared by every list / show
    / new / delete / expire command across api_key, nodes, policy,
    preauthkeys, users — plus the Result / Created / Expiration
    column headers used in printOutput maps.

  hscontrol/templates/design.go
    cssBorderHS, cssBreakWord, cssCenter, cssOverflowWrap — shared
    styles applied across design.go, ping.go, register_confirm.go.
    spaceS already existed; switch raw "0.5rem" literals to it.

  integration/hsic/hsic.go
    binHeadscale, flagOutput, acceptJSON — names invoked across
    hsic.go and config.go.

  integration/tsic/tsic.go
    tailscaleBin — used across docker exec call sites.
This commit is contained in:
Kristoffer Dalby 2026-05-18 18:33:40 +00:00
parent 64c398f2c2
commit e00c899219
15 changed files with 263 additions and 216 deletions

View file

@ -31,11 +31,11 @@ type RegisterConfirmInfo struct {
User string
// Hostname is the hostname the registering tailscaled instance
// reported in its RegisterRequest.
// reported in its [tailcfg.RegisterRequest].
Hostname string
// OS is the operating system the registering tailscaled reported.
// May be the empty string when the client did not send Hostinfo.
// May be the empty string when the client did not send [tailcfg.Hostinfo].
OS string
// MachineKey is the short fingerprint of the registering machine
@ -110,13 +110,13 @@ func deviceTable(rows [4][2]string) *elem.Element {
styles.FontWeight: "600",
styles.WhiteSpace: "nowrap",
styles.Color: "var(--md-default-fg-color--light)",
styles.BorderBottom: "1px solid var(--hs-border)",
styles.BorderBottom: cssBorderHS,
}.ToInline(),
}, elem.Text(row[0])),
elem.Td(attrs.Props{
attrs.Style: styles.Props{
styles.Padding: "0.5rem 0",
styles.BorderBottom: "1px solid var(--hs-border)",
styles.BorderBottom: cssBorderHS,
}.ToInline(),
}, val),
))