feat(commit): text templating in commit messages

This commit is contained in:
Lewis Wynne 2026-02-12 20:00:57 +00:00
parent 4e78cefd56
commit 2ca32769d5
30 changed files with 281 additions and 115 deletions

View file

@ -1,6 +1,6 @@
# Init creates a config file
$ pda config init
ok generated config: /tmp/TestMain2533282848/002/config.toml
ok generated config: ${ROOTDIR}/config/config.toml
# Second init fails
$ pda config init --> FAIL
@ -9,7 +9,7 @@ hint use '--update' to update your config, or '--new' to get a fresh copy
# Init --new overwrites
$ pda config init --new
ok generated config: /tmp/TestMain2533282848/002/config.toml
ok generated config: ${ROOTDIR}/config/config.toml
# --update preserves user changes
$ pda config set list.always_show_all_stores false
@ -18,7 +18,7 @@ $ pda config get list.always_show_all_stores
false
$ pda config init --update
$ pda config get list.always_show_all_stores
ok updated config: /tmp/TestMain2533282848/002/config.toml
ok updated config: ${ROOTDIR}/config/config.toml
false
# --new and --update are mutually exclusive
@ -27,4 +27,4 @@ FAIL --new and --update are mutually exclusive
# Reset for other tests
$ pda config init --new
ok generated config: /tmp/TestMain2533282848/002/config.toml
ok generated config: ${ROOTDIR}/config/config.toml

View file

@ -15,4 +15,4 @@ list.default_columns = key,store,value,ttl
git.auto_fetch = false
git.auto_commit = false
git.auto_push = false
git.default_commit_message = sync: {{.Time}}
git.default_commit_message = {{ summary }} {{ time }}

12
testdata/list-all.ct vendored
View file

@ -3,8 +3,8 @@ $ pda set lax@laa 1
$ pda set lax@lab 2
$ pda ls --key "lax" --format tsv
Key Store Value TTL
lax laa 1 no expiry
lax lab 2 no expiry
lax laa 1 none
lax lab 2 none
$ pda ls --key "lax" --count
2
$ pda ls --key "lax" --format json
@ -12,15 +12,15 @@ $ pda ls --key "lax" --format json
# Positional arg narrows to one store
$ pda ls laa --key "lax" --format tsv
Key Store Value TTL
lax laa 1 no expiry
lax laa 1 none
# --store glob filter
$ pda ls --store "la?" --key "lax" --format tsv
Key Store Value TTL
lax laa 1 no expiry
lax lab 2 no expiry
lax laa 1 none
lax lab 2 none
$ pda ls --store "laa" --key "lax" --format tsv
Key Store Value TTL
lax laa 1 no expiry
lax laa 1 none
# --store cannot be combined with positional arg
$ pda ls --store "laa" laa --> FAIL
FAIL cannot use --store with a store argument

View file

@ -3,7 +3,7 @@ $ pda config set list.always_hide_header true
$ pda set a@lchh 1
$ pda ls lchh --format tsv
ok list.always_hide_header set to 'true'
a lchh 1 no expiry
a lchh 1 none
# Reset
$ pda config set list.always_hide_header false

View file

@ -3,5 +3,5 @@ $ pda set a@csv 1
$ pda set b@csv 2
$ pda ls csv --format csv
Key,Store,Value,TTL
a,csv,1,no expiry
b,csv,2,no expiry
a,csv,1,none
b,csv,2,none

View file

@ -4,5 +4,5 @@ $ pda set b@md 2
$ pda ls md --format markdown
| Key | Store | Value | TTL |
| --- | --- | --- | --- |
| a | md | 1 | no expiry |
| b | md | 2 | no expiry |
| a | md | 1 | none |
| b | md | 2 | none |

View file

@ -3,10 +3,10 @@ $ pda set a2@lg 2
$ pda set b1@lg 3
$ pda ls lg --key "a*" --format tsv
Key Store Value TTL
a1 lg 1 no expiry
a2 lg 2 no expiry
a1 lg 1 none
a2 lg 2 none
$ pda ls lg --key "b*" --format tsv
Key Store Value TTL
b1 lg 3 no expiry
b1 lg 3 none
$ pda ls lg --key "c*" --> FAIL
FAIL cannot ls '@lg': no matches for key pattern 'c*'

View file

@ -3,9 +3,9 @@ $ pda set apiurl@kv https://api.example.com
$ pda set dbpass@kv s3cret
$ pda ls kv -k "db*" -v "**localhost**" --format tsv
Key Store Value TTL
dburl kv postgres://localhost:5432 no expiry
dburl kv postgres://localhost:5432 none
$ pda ls kv -k "*url*" -v "**example**" --format tsv
Key Store Value TTL
apiurl kv https://api.example.com no expiry
apiurl kv https://api.example.com none
$ pda ls kv -k "db*" -v "**nomatch**" --> FAIL
FAIL cannot ls '@kv': no matches for key pattern 'db*' and value pattern '**nomatch**'

View file

@ -1,4 +1,4 @@
# --no-header suppresses the header row
$ pda set a@nh 1
$ pda ls nh --format tsv --no-header
a nh 1 no expiry
a nh 1 none

View file

@ -2,4 +2,4 @@
$ pda set a@nk 1
$ pda ls nk --format tsv --no-keys
Store Value TTL
nk 1 no expiry
nk 1 none

View file

@ -2,4 +2,4 @@
$ pda set a@nv 1
$ pda ls nv --format tsv --no-values
Key Store TTL
a nv no expiry
a nv none

View file

@ -3,7 +3,7 @@ $ pda set a@lsalpha 1
$ pda set b@lsbeta 2
$ pda ls lsalpha --format tsv
Key Store Value TTL
a lsalpha 1 no expiry
a lsalpha 1 none
$ pda ls lsbeta --format tsv
Key Store Value TTL
b lsbeta 2 no expiry
b lsbeta 2 none

View file

@ -4,12 +4,12 @@ $ pda set greeting@vt < tmpval
$ pda set number@vt 42
$ pda ls vt --value "**world**" --format tsv
Key Store Value TTL
greeting vt hello world (..1 more chars) no expiry
greeting vt hello world (..1 more chars) none
$ pda ls vt --value "**https**" --format tsv
Key Store Value TTL
url vt https://example.com no expiry
url vt https://example.com none
$ pda ls vt --value "*" --format tsv
Key Store Value TTL
number vt 42 no expiry
number vt 42 none
$ pda ls vt --value "**nomatch**" --> FAIL
FAIL cannot ls '@vt': no matches for value pattern '**nomatch**'

View file

@ -4,5 +4,5 @@ $ pda set greeting@vm < tmpval
$ pda set number@vm 42
$ pda ls vm --value "**world**" --value "42" --format tsv
Key Store Value TTL
greeting vm hello world (..1 more chars) no expiry
number vm 42 no expiry
greeting vm hello world (..1 more chars) none
number vm 42 none

View file

@ -7,4 +7,4 @@ $ pda get x@ms2
y
$ pda ls ms2 --format tsv
Key Store Value TTL
x ms2 y no expiry
x ms2 y none

View file

@ -3,8 +3,8 @@ $ pda set foo@rdd 1
$ pda set bar@rdd 2
$ pda ls rdd --format tsv
Key Store Value TTL
bar rdd 2 no expiry
foo rdd 1 no expiry
bar rdd 2 none
foo rdd 1 none
$ pda rm foo@rdd --key "*@rdd" -y
$ pda get bar@rdd --> FAIL
FAIL cannot get 'bar@rdd': no such key