commit 3572500b3b618c0d34e893a832f2e30dbbec6497
parent 08b41f0e7fa897548fc90890f91af4eac9bec71b
Author: Sean Enck <sean@ttypty.com>
Date: Sun, 11 Aug 2024 13:13:22 -0400
these functions are only used once
Diffstat:
2 files changed, 13 insertions(+), 19 deletions(-)
diff --git a/internal/config/core.go b/internal/config/core.go
@@ -283,14 +283,6 @@ func NewPlatform() (SystemPlatform, error) {
return unknownPlatform, errors.New("unable to detect clipboard mode")
}
-func toString(windows []ColorWindow) string {
- var results []string
- for _, w := range windows {
- results = append(results, fmt.Sprintf("%d%s%d", w.Start, colorWindowSpan, w.End))
- }
- return strings.Join(results, colorWindowDelimiter)
-}
-
// ParseColorWindow will handle parsing a window of colors for TOTP operations
func ParseColorWindow(windowString string) ([]ColorWindow, error) {
var rules []ColorWindow
@@ -504,12 +496,3 @@ func (p PlatformTypes) List() []string {
sort.Strings(vals)
return vals
}
-
-func newPlatformsTypes() PlatformTypes {
- obj := PlatformTypes{}
- obj.MacOSPlatform = "macos"
- obj.LinuxWaylandPlatform = "linux-wayland"
- obj.LinuxXPlatform = "linux-x"
- obj.WindowsLinuxPlatform = "wsl"
- return obj
-}
diff --git a/internal/config/vars.go b/internal/config/vars.go
@@ -33,11 +33,22 @@ const (
var (
// Platforms are the known platforms for lockbox
- Platforms = newPlatformsTypes()
+ Platforms = PlatformTypes{
+ MacOSPlatform: "macos",
+ LinuxWaylandPlatform: "linux-wayland",
+ LinuxXPlatform: "linux-x",
+ WindowsLinuxPlatform: "wsl",
+ }
// TOTPDefaultColorWindow is the default coloring rules for totp
TOTPDefaultColorWindow = []ColorWindow{{Start: 0, End: 5}, {Start: 30, End: 35}}
// TOTPDefaultBetween is the default color window as a string
- TOTPDefaultBetween = toString(TOTPDefaultColorWindow)
+ TOTPDefaultBetween = func() string {
+ var results []string
+ for _, w := range TOTPDefaultColorWindow {
+ results = append(results, fmt.Sprintf("%d%s%d", w.Start, colorWindowSpan, w.End))
+ }
+ return strings.Join(results, colorWindowDelimiter)
+ }()
// EnvClipMax gets the maximum clipboard time
EnvClipMax = environmentRegister(EnvironmentInt{
environmentBase: environmentBase{