lockbox

password manager
Log | Files | Refs | README | LICENSE

commit 8d40ef5f65d6cac6782b85f1fcae4bd6ace8a051
parent 62e65efb17e5f0f0b70cef5c31124676b197cc90
Author: Sean Enck <sean@ttypty.com>
Date:   Sun,  8 Dec 2024 11:28:36 -0500

stop exporting var command to completions

Diffstat:
Minternal/app/commands/core.go | 2+-
Minternal/app/completions/core.go | 2+-
Minternal/app/info_test.go | 14+++++++-------
Mtests/main.go | 2+-
4 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/internal/app/commands/core.go b/internal/app/commands/core.go @@ -31,7 +31,7 @@ const ( // Remove removes an entry Remove = "rm" // Env shows environment information used by lockbox - Env = "var" + Env = "vars" // TOTPClip is the argument for copying totp codes to clipboard TOTPClip = Clip // TOTPMinimal is the argument for getting the short version of a code diff --git a/internal/app/completions/core.go b/internal/app/completions/core.go @@ -119,7 +119,7 @@ func Generate(completionType, exe string) ([]string, error) { } c.Conditionals = NewConditionals() - c.Options = c.newGenOptions([]string{commands.Env, commands.Help, commands.List, commands.Show, commands.Version, commands.JSON}, + c.Options = c.newGenOptions([]string{commands.Help, commands.List, commands.Show, commands.Version, commands.JSON}, map[string]string{ commands.Clip: c.Conditionals.Not.CanClip, commands.TOTP: c.Conditionals.Not.CanTOTP, diff --git a/internal/app/info_test.go b/internal/app/info_test.go @@ -57,7 +57,7 @@ func TestEnvInfo(t *testing.T) { os.Clearenv() store.Clear() var buf bytes.Buffer - ok, err := app.Info(&buf, "var", []string{}) + ok, err := app.Info(&buf, "vars", []string{}) if !ok || err != nil { t.Errorf("invalid error: %v", err) } @@ -66,7 +66,7 @@ func TestEnvInfo(t *testing.T) { } buf = bytes.Buffer{} store.SetString("LOCKBOX_STORE", "1") - ok, err = app.Info(&buf, "var", []string{}) + ok, err = app.Info(&buf, "vars", []string{}) if !ok || err != nil { t.Errorf("invalid error: %v", err) } @@ -74,7 +74,7 @@ func TestEnvInfo(t *testing.T) { t.Error("nothing written") } buf = bytes.Buffer{} - ok, err = app.Info(&buf, "var", []string{"completions"}) + ok, err = app.Info(&buf, "vars", []string{"completions"}) if !ok || err != nil { t.Errorf("invalid error: %v", err) } @@ -83,7 +83,7 @@ func TestEnvInfo(t *testing.T) { } store.SetString("LOCKBOX_READONLY", "true") buf = bytes.Buffer{} - ok, err = app.Info(&buf, "var", []string{"completions"}) + ok, err = app.Info(&buf, "vars", []string{"completions"}) if !ok || err != nil { t.Errorf("invalid error: %v", err) } @@ -91,7 +91,7 @@ func TestEnvInfo(t *testing.T) { t.Error("nothing written") } buf = bytes.Buffer{} - ok, err = app.Info(&buf, "var", []string{"LOCKBOX_READONLY"}) + ok, err = app.Info(&buf, "vars", []string{"LOCKBOX_READONLY"}) if !ok || err != nil { t.Errorf("invalid error: %v", err) } @@ -99,14 +99,14 @@ func TestEnvInfo(t *testing.T) { t.Error("nothing written") } buf = bytes.Buffer{} - ok, err = app.Info(&buf, "var", []string{"garbage"}) + ok, err = app.Info(&buf, "vars", []string{"garbage"}) if !ok || err != nil { t.Errorf("invalid error: %v", err) } if buf.String() != "\n" { t.Error("nothing written") } - if _, err = app.Info(&buf, "var", []string{"test", "default"}); err.Error() != "invalid env command, too many arguments" { + if _, err = app.Info(&buf, "vars", []string{"test", "default"}); err.Error() != "invalid env command, too many arguments" { t.Errorf("invalid error: %v", err) } } diff --git a/tests/main.go b/tests/main.go @@ -331,7 +331,7 @@ func test(profile string) error { r.run("", "pwgen") // what is env - r.run("", fmt.Sprintf("var | sed 's#/%s#/datadir#g' | grep -v CREDENTIALS | sort", profile)) + r.run("", fmt.Sprintf("vars | sed 's#/%s#/datadir#g' | grep -v CREDENTIALS | sort", profile)) // cleanup and diff results tmpFile := fmt.Sprintf("%s.tmp", r.log)