mirror of
https://codeberg.org/scip/anydb.git
synced 2025-12-16 20:10:59 +01:00
Co-authored-by: Thomas von Dein <tom@vondein.org>
This commit is contained in:
21
anydb.pod
21
anydb.pod
@@ -448,17 +448,20 @@ The following template variables can be used:
|
||||
|
||||
=over
|
||||
|
||||
=item B<Key> - string
|
||||
=item B<.Key> - string
|
||||
|
||||
=item B<Value> - string
|
||||
=item B<.Value> - string
|
||||
|
||||
=item B<Bin> - []byte
|
||||
=item B<.Bin> - []byte
|
||||
|
||||
=item B<Created> - time.Time
|
||||
=item B<.Created> - timestamp.Time
|
||||
|
||||
=item B<Tags> - []string
|
||||
To retrieve a string representation of the timestamp, use C<.Created.AsTime>.
|
||||
If you need a unix timestamp since epoch, use C<.Created.Unix>.
|
||||
|
||||
=item B<Encrypted> bool
|
||||
=item B<.Tags> - []string
|
||||
|
||||
=item B<.Encrypted> bool
|
||||
|
||||
=back
|
||||
|
||||
@@ -473,12 +476,12 @@ Only show the keys of all entries:
|
||||
Format the list in a way so that is possible to evaluate it in a
|
||||
shell:
|
||||
|
||||
eval $(anydb get foo -m template -T "key='{{ .Key }}' value='{{ .Value }}' ts='{{ .Created}}'")
|
||||
echo "Key: $key, Value: $value"
|
||||
eval $(anydb get foo -m template -T "key='{{ .Key }}' value='{{ .Value }}' ts='{{ .Created.AsTime}}'")
|
||||
echo "Key: $key, Value: $value, When: $ts"
|
||||
|
||||
Print the values in CSV format ONLY if they have some tag:
|
||||
|
||||
anydb list -m template -T "{{ if .Tags }}{{ .Key }},{{ .Value }},{{ .Created}}{{ end }}"
|
||||
anydb list -m template -T "{{ if .Tags }}{{ .Key }},{{ .Value }},{{ .Created.AsTime}}{{ end }}"
|
||||
|
||||
|
||||
=head1 CONFIGURATION
|
||||
|
||||
@@ -26,7 +26,7 @@ import (
|
||||
"github.com/tlinden/anydb/common"
|
||||
)
|
||||
|
||||
var Version string = "v0.1.3"
|
||||
var Version string = "v0.1.4"
|
||||
|
||||
type BucketConfig struct {
|
||||
Encrypt bool
|
||||
|
||||
@@ -139,8 +139,9 @@ Type "# using template output mode you can freely design how to print stuff"
|
||||
Enter
|
||||
Type "# here, we print the values in CSV format ONLY if they have some tag"
|
||||
Enter
|
||||
Type "# also note, that we're printing the creation timestamp as epoch"
|
||||
Sleep 1s
|
||||
Type `anydb ls -m template -T "{{ if .Tags }}{{ .Key }},{{ .Value }},{{ .Created}}{{ end }}"`
|
||||
Type `anydb ls -m template -T "{{ if .Tags }}{{ .Key }},{{ .Value }},{{ .Created.AsTime.Unix}}{{ end }}"`
|
||||
Enter
|
||||
Sleep 3s
|
||||
|
||||
|
||||
Reference in New Issue
Block a user