Rebrand user-visible CLI text; add legacy fallbacks for keyring, cache dir and version prefix
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4cb3bda43a
commit
ab4ed3c9e5
184 files changed
+934
-851
No files matched your search
+35
-3
@@ -11,7 +11,26 @@ import (
|
||||
gvers "github.com/hashicorp/go-version"
|
||||
)
|
||||
|
||||
const BoundaryPrefix = "Boundary v"
|
||||
const (
|
||||
// BoundaryPrefix is the release version prefix used on the wire. It is
|
||||
// kept as the emitted prefix so that this binary stays compatible with
|
||||
// upstream HashiCorp Boundary peers that parse it.
|
||||
BoundaryPrefix = "Boundary v"
|
||||
// ThresholdPrefix is the release version prefix used for display and
|
||||
// accepted additively when parsing.
|
||||
ThresholdPrefix = "Threshold v"
|
||||
)
|
||||
|
||||
// TrimReleasePrefix removes a leading (or embedded) "Boundary v" or
|
||||
// "Threshold v" release prefix from s, if present.
|
||||
func TrimReleasePrefix(s string) string {
|
||||
for _, p := range []string{BoundaryPrefix, ThresholdPrefix} {
|
||||
if idx := strings.Index(s, p); idx >= 0 {
|
||||
return s[idx+len(p):]
|
||||
}
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
// Info
|
||||
type Info struct {
|
||||
@@ -85,6 +104,7 @@ func (c *Info) Semver() *gvers.Version {
|
||||
func FromVersionString(s string) *Info {
|
||||
s = strings.TrimSpace(s)
|
||||
s = strings.TrimPrefix(s, BoundaryPrefix)
|
||||
s = strings.TrimPrefix(s, ThresholdPrefix)
|
||||
i := Info{}
|
||||
|
||||
// Get the revision
|
||||
@@ -113,14 +133,26 @@ func FromVersionString(s string) *Info {
|
||||
return &i
|
||||
}
|
||||
|
||||
// FullVersionNumber returns the wire-format release version, which uses the
|
||||
// upstream "Boundary v" prefix for compatibility with peers.
|
||||
func (c *Info) FullVersionNumber(rev bool) string {
|
||||
return c.fullVersionNumber(BoundaryPrefix, "Boundary", rev)
|
||||
}
|
||||
|
||||
// DisplayVersionNumber returns the release version for display to users,
|
||||
// using the "Threshold v" prefix. Do not send this value over the wire.
|
||||
func (c *Info) DisplayVersionNumber(rev bool) string {
|
||||
return c.fullVersionNumber(ThresholdPrefix, "Threshold", rev)
|
||||
}
|
||||
|
||||
func (c *Info) fullVersionNumber(prefix, name string, rev bool) string {
|
||||
var versionString bytes.Buffer
|
||||
|
||||
if Version == "unknown" && VersionPrerelease == "unknown" {
|
||||
return "Boundary (version unknown)"
|
||||
return name + " (version unknown)"
|
||||
}
|
||||
|
||||
fmt.Fprintf(&versionString, "%s%s", BoundaryPrefix, c.Version)
|
||||
fmt.Fprintf(&versionString, "%s%s", prefix, c.Version)
|
||||
if c.VersionPrerelease != "" {
|
||||
fmt.Fprintf(&versionString, "-%s", c.VersionPrerelease)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user