fix #24: clarify template use of .Value (#25)

This commit is contained in:
T. von Dein
2026-04-29 08:33:10 +02:00
parent 4fa42e27e4
commit cafc65aea7
4 changed files with 40 additions and 4 deletions

18
anydb.1
View File

@@ -133,7 +133,7 @@
.\" ========================================================================
.\"
.IX Title "ANYDB 1"
.TH ANYDB 1 "2025-11-03" "1" "User Commands"
.TH ANYDB 1 "2026-04-29" "1" "User Commands"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -613,8 +613,16 @@ The following template variables can be used:
.PD 0
.IP "\fB.Value\fR \- string" 4
.IX Item ".Value - string"
.PD
To be able to use the value in a template, you'll need to add the
\&\f(CW\*(C`\-s\*(C'\fR flag so that values are included in output data
stream. Otherwise you can only use \f(CW\*(C`.Preview\*(C'\fR.
.IP "\fB.Preview\fR string" 4
.IX Item ".Preview string"
First line of entry value (if it is a string).
.IP "\fB.Bin\fR \- []byte" 4
.IX Item ".Bin - []byte"
.PD 0
.IP "\fB.Created\fR \- timestamp.Time" 4
.IX Item ".Created - timestamp.Time"
.PD
@@ -729,7 +737,7 @@ Some curl example calls to the \s-1API:\s0
Post a new key:
curl \-X \s-1PUT\s0 localhost:8787/anydb/v1/ \e
\-H 'Content\-Type: application/json' \e
\-d '{\*(L"key\*(R":\*(L"foo\*(R",\*(L"val\*(R":\*(L"bar\*(R"}'
\-d '{\*(L"key\*(R":\*(L"foo\*(R",\*(L"data\*(R":\*(L"bar\*(R"}'
.PP
Retrieve the value:
.PP
@@ -742,6 +750,12 @@ List all keys:
.Vb 1
\& curl localhost:8787/anydb/v1/
.Ve
.PP
Delete an entry:
.PP
.Vb 1
\& curl \-s \-X DELETE http://localhost:8787/anydb/v1/foo
.Ve
.SH "BUGS"
.IX Header "BUGS"
In order to report a bug, unexpected behavior, feature requests

View File

@@ -452,6 +452,17 @@ The following template variables can be used:
=item B<.Value> - string
To be able to use the value in a template, you'll need to add the
C<-s> flag so that values are included in output data
stream. Otherwise you can only use C<.Preview>.
Be careful if you use C<-s> and C<.Value> though: if a value is a
multiline string, it may clutter your output.
=item B<.Preview> string
First line of entry value (if it is a string).
=item B<.Bin> - []byte
=item B<.Created> - timestamp.Time

View File

@@ -30,7 +30,7 @@ import (
"github.com/tlinden/yadu"
)
var Version string = "v0.3.0"
var Version string = "v0.3.1"
type BucketConfig struct {
Encrypt bool

View File

@@ -413,6 +413,13 @@ TEMPLATES
.Key - string
.Value - string
To be able to use the value in a template, you'll need to add the
"-s" flag so that values are included in output data stream.
Otherwise you can only use ".Preview".
.Preview string
First line of entry value (if it is a string).
.Bin - []byte
.Created - timestamp.Time
To retrieve a string representation of the timestamp, use
@@ -504,7 +511,7 @@ REST API
Some curl example calls to the API:
Post a new key: curl -X PUT localhost:8787/anydb/v1/ \ -H 'Content-Type:
application/json' \ -d '{"key":"foo","val":"bar"}'
application/json' \ -d '{"key":"foo","data":"bar"}'
Retrieve the value:
@@ -514,6 +521,10 @@ REST API
curl localhost:8787/anydb/v1/
Delete an entry:
curl -s -X DELETE http://localhost:8787/anydb/v1/foo
BUGS
In order to report a bug, unexpected behavior, feature requests or to
submit a patch, please open an issue on github: