lockbox

password manager
Log | Files | Refs | README | LICENSE

commit fc802a2793e58efc7f699fa942ed6a60985a99ac
parent 3c3c0c1492a3200439e796d7be17ddb0695ba784
Author: Sean Enck <sean@ttypty.com>
Date:   Fri,  6 Dec 2024 20:08:43 -0500

allow completions, interactive (reroute modtime) through cleaner toml

Diffstat:
Minternal/app/core_test.go | 2+-
Minternal/config/config.toml | 8+++++---
Minternal/config/toml.go | 28+++++++++++++++-------------
Minternal/config/toml_test.go | 2+-
Mtests/run.sh | 1+
5 files changed, 23 insertions(+), 18 deletions(-)

diff --git a/internal/app/core_test.go b/internal/app/core_test.go @@ -13,7 +13,7 @@ func TestUsage(t *testing.T) { t.Errorf("invalid usage, out of date? %d", len(u)) } u, _ = app.Usage(true, "lb") - if len(u) != 211 { + if len(u) != 215 { t.Errorf("invalid verbose usage, out of date? %d", len(u)) } for _, usage := range u { diff --git a/internal/config/config.toml b/internal/config/config.toml @@ -3,6 +3,11 @@ platform = "" readonly = false store = "" include = [] +interactive = true + +[defaults] +modtime = "" +completion = "" [color] enabled = true @@ -41,6 +46,3 @@ attribute = "" between = [] format = "" max = 0 - -[entry] -modtime = "" diff --git a/internal/config/toml.go b/internal/config/toml.go @@ -33,19 +33,20 @@ var ( //go:embed "config.toml" ExampleTOML string redirects = map[string]string{ - "HOOK_DIRECTORY": EnvHookDir.Key(), - "HOOK_ENABLED": EnvNoHooks.Key(), - "JSON_MODE": EnvJSONDataOutput.Key(), - "JSON_HASH_LENGTH": EnvHashLength.Key(), - "KEYS_FILE": EnvKeyFile.Key(), - "KEYS_MODE": EnvKeyMode.Key(), - "KEYS_KEY": envKey.Key(), - "CLIP_ENABLED": EnvNoClip.Key(), - "COLOR_ENABLED": EnvNoColor.Key(), - "PWGEN_ENABLED": EnvNoPasswordGen.Key(), - "TOTP_ENABLED": EnvNoTOTP.Key(), - "TOTP_ATTRIBUTE": EnvTOTPToken.Key(), - "ENTRY_MODTIME": EnvModTime.Key(), + "HOOK_DIRECTORY": EnvHookDir.Key(), + "HOOK_ENABLED": EnvNoHooks.Key(), + "JSON_MODE": EnvJSONDataOutput.Key(), + "JSON_HASH_LENGTH": EnvHashLength.Key(), + "KEYS_FILE": EnvKeyFile.Key(), + "KEYS_MODE": EnvKeyMode.Key(), + "KEYS_KEY": envKey.Key(), + "CLIP_ENABLED": EnvNoClip.Key(), + "COLOR_ENABLED": EnvNoColor.Key(), + "PWGEN_ENABLED": EnvNoPasswordGen.Key(), + "TOTP_ENABLED": EnvNoTOTP.Key(), + "TOTP_ATTRIBUTE": EnvTOTPToken.Key(), + "DEFAULTS_MODTIME": EnvModTime.Key(), + "DEFAULTS_COMPLETION": EnvDefaultCompletion.Key(), } arrayTypes = []string{ EnvClipCopy.Key(), @@ -69,6 +70,7 @@ var ( EnvNoTOTP.Key(), EnvPasswordGenTitle.Key(), EnvReadOnly.Key(), + EnvInteractive.Key(), } reverseMap = map[string][]string{ "[]": arrayTypes, diff --git a/internal/config/toml_test.go b/internal/config/toml_test.go @@ -276,7 +276,7 @@ func TestDefaultTOMLToLoadFile(t *testing.T) { count++ } } - if count != 29 { + if count != 31 { t.Errorf("invalid environment after load: %d", count) } } diff --git a/tests/run.sh b/tests/run.sh @@ -221,6 +221,7 @@ printf "%-10s ... " "$1" { cat << EOF store = "$LOCKBOX_STORE" +interactive = false [clip] copy = [$(echo "$LOCKBOX_CLIP_COPY" | sed 's/ /", "/g;s/^/"/g;s/$/"/g')]