lockbox

password manager
Log | Files | Refs | README | LICENSE

commit c28cbdaec81a769d98309f5b72dd44d81efbd00c
parent c029d24e71560a75946a9f793caaa9946442e65b
Author: Sean Enck <sean@ttypty.com>
Date:   Sun,  7 Sep 2025 10:51:43 -0400

linting cleanup

Diffstat:
Mcmd/lb/main.go | 6++++--
Minternal/app/commands/core.go | 1+
Minternal/app/completions/core.go | 2++
Minternal/app/completions/core_test.go | 11+++++++++++
Minternal/app/list.go | 4++++
Minternal/config/core.go | 1-
6 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/cmd/lb/main.go b/cmd/lb/main.go @@ -84,10 +84,12 @@ func run() error { return app.ReKey(p) case commands.List, commands.Groups, commands.Fields: mode := app.ListEntriesMode - if command == commands.Groups { + switch command { + case commands.Groups: mode = app.ListGroupsMode - } else if command == commands.Fields { + case commands.Fields: mode = app.ListFieldsMode + } return app.List(p, mode) case commands.Unset: diff --git a/internal/app/commands/core.go b/internal/app/commands/core.go @@ -66,6 +66,7 @@ const ( TOTPSeed = "seed" // Health will show health information (for debugging/troubleshooting) Health = "health" + // Fields will display groups+possible/allowed fields Fields = "fields" ) diff --git a/internal/app/completions/core.go b/internal/app/completions/core.go @@ -40,12 +40,14 @@ type ( Options OptionList TOTPSubCommands OptionList } + // OptionList represents completion list of available options OptionList []string ) //go:embed shell/* var shell embed.FS +// Join will space-delimited join all options in a list func (o OptionList) Join() string { return strings.Join(o, " ") } diff --git a/internal/app/completions/core_test.go b/internal/app/completions/core_test.go @@ -86,3 +86,14 @@ func testCompletion(t *testing.T, completionMode, need string) { t.Errorf("invalid output, bad shell generation: %v", v) } } + +func TestJoin(t *testing.T) { + l := completions.OptionList{} + if l.Join() != "" { + t.Error("invalid list, should be empty") + } + l = completions.OptionList{"x", "y ", " z a"} + if l.Join() != "x y z a" { + t.Errorf("invalid join: %s", l.Join()) + } +} diff --git a/internal/app/list.go b/internal/app/list.go @@ -10,11 +10,15 @@ import ( "github.com/enckse/lockbox/internal/kdbx" ) +// ListMode indicates how listing will be done/output type ListMode int const ( + // ListEntriesMode will list the actual entries ListEntriesMode ListMode = iota + // ListGroupsMode will list groups only (e.g. dirnames of all entries) ListGroupsMode + // ListFieldsMode will list groups only, but with ALL possible/allowed field names ListFieldsMode ) diff --git a/internal/config/core.go b/internal/config/core.go @@ -29,7 +29,6 @@ const ( // ModTimeFormat is the expected modtime format ModTimeFormat = time.RFC3339 exampleColorWindow = "start" + TimeWindowSpan + "end" - detectedValue = "(detected)" unset = "(unset)" arrayDelimiter = " " // TimeWindowSpan indicates the delineation between start -> end (start:end)