diff --git a/anydb.1 b/anydb.1 index 5a013bd..4a7e1a3 100644 --- a/anydb.1 +++ b/anydb.1 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" Standard preamble: .\" ======================================================================== @@ -133,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "ANYDB 1" -.TH ANYDB 1 "2024-12-23" "1" "User Commands" +.TH ANYDB 1 "2024-12-25" "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 @@ -276,7 +276,7 @@ You might as well specify a file directly using the \f(CW\*(C`\-f\*(C'\fR option .PP Values can be encrypted using \fBChaCha20Poly1305\fR when you specify the \&\f(CW\*(C`\-e\*(C'\fR option. Anydb will ask you interactively for a passphrase. You -might as well provide the passphrase using the environment variable +can also provide the passphrase using the environment variable \&\f(CW\*(C`ANYDB_PASSWORD\*(C'\fR. To encrypt the value, a cryptographically secure key will be derived from the passphrase using the ArgonID2 algorithm. Each value can be encrypted with another passphrase. So, @@ -339,7 +339,7 @@ If the value is encrypted, you will be asked for the passphrase to decrypt it. If the environment variable \f(CW\*(C`ANYDB_PASSWORD\*(C'\fR is set, its value will be used instead. .PP -There are different output modes you can choos from: simple, wide and +There are different output modes you can choose from: simple, wide and json. The \*(L"simple\*(R" mode is the default one, it just prints the value as is. The \*(L"wide\*(R" mode prints a tabular output similar to the \fBlist\fR subcommand, see there for more details. The options \f(CW\*(C`\-n\*(C'\fR and \f(CW\*(C`\-N\*(C'\fR @@ -356,14 +356,16 @@ Usage: .PP .Vb 2 \& Usage: -\& anydb list [] [\-t ] [\-m ] [\-n \-N] [\-T ] [flags] +\& anydb list [] [\-t ] [\-m ] [\-n \-N] [\-T ] [\-i] [flags] \& \& Aliases: \& list, /, ls \& \& Flags: +\& \-i, \-\-case\-insensitive filter case insensitive \& \-h, \-\-help help for list -\& \-m, \-\-mode string output format (table|wide|json|template), wide is a verbose table. (default \*(Aqtable\*(Aq) +\& \-m, \-\-mode string output format (table|wide|json|template), +\& wide is a verbose table. (default \*(Aqtable\*(Aq) \& \-n, \-\-no\-headers omit headers in tables \& \-N, \-\-no\-human do not translate to human readable values \& \-t, \-\-tags stringArray tags, multiple allowed @@ -405,6 +407,8 @@ about the syntax, refer to regexp dialect is not \s-1PCRE\s0 compatible, but supports most of its features. .PP +If you want to search case insensitive, add the option \f(CW\*(C`\-i\*(C'\fR. +.PP You can \- as with the \fBget\fR command \- use other output modes. The default mode is \*(L"table\*(R". The \*(L"wide\*(R" mode is, as already mentioned, a more detailed table. Also supported is \*(L"json\*(R" mode and \*(L"template\*(R" @@ -465,7 +469,7 @@ behavior by setting the environment variable \f(CW\*(C`EDITOR\*(C'\fR appropriat Please note, that this does not work with binary content! .SS "export" .IX Subsection "export" -Since the bbold database file is not portable across platforms (it is +Since the bbolt database file is not portable across platforms (it is bound to the endianess of the \s-1CPU\s0 it was being created on), you might want to create a backup file of your database. You can do this with the \fBexport\fR subcommand. @@ -599,8 +603,20 @@ required, the template provided applies to every matching entry separatley. .PP The following template variables can be used: -.IP "\fBKey\fR \- string =item \fBValue\fR \- string =item \fBBin\fR \- []byte =item \fBCreated\fR \- time.Time =item \fBTags\fR \- []string =item \fBEncrypted\fR bool" 4 -.IX Item "Key - string =item Value - string =item Bin - []byte =item Created - time.Time =item Tags - []string =item Encrypted bool" +.IP "\fBKey\fR \- string" 4 +.IX Item "Key - string" +.PD 0 +.IP "\fBValue\fR \- string" 4 +.IX Item "Value - string" +.IP "\fBBin\fR \- []byte" 4 +.IX Item "Bin - []byte" +.IP "\fBCreated\fR \- time.Time" 4 +.IX Item "Created - time.Time" +.IP "\fBTags\fR \- []string" 4 +.IX Item "Tags - []string" +.IP "\fBEncrypted\fR bool" 4 +.IX Item "Encrypted bool" +.PD .PP Prepend a single dot (\*(L".\*(R") before each variable name. .PP @@ -627,7 +643,7 @@ Print the values in \s-1CSV\s0 format \s-1ONLY\s0 if they have some tag: .Ve .SH "CONFIGURATION" .IX Header "CONFIGURATION" -Anydb looks at the following location for a configuration file, in +Anydb looks at the following locations for a configuration file, in that order: .ie n .IP """$HOME/.config/anydb/anydb.toml""" 4 .el .IP "\f(CW$HOME/.config/anydb/anydb.toml\fR" 4 @@ -643,17 +659,18 @@ that order: .el .IP "or specify one using \f(CW\-c\fR" 4 .IX Item "or specify one using -c" .PD +.PP The configuration format uses the \s-1TOML\s0 language, refer to for more details. The key names correspond to the commandline options in most cases. -.Sp +.PP Configuration follows a certain precedence: the files are tried to be read in the given order, followed by commandline options. That is, the last configuration file wins, unless the user provides a commandline option, then this setting will be taken. -.Sp +.PP A complete configuration file might look like this: -.Sp +.PP .Vb 7 \& # defaults \& dbfile = "~/.config/anydb/default.db" @@ -670,7 +687,7 @@ A complete configuration file might look like this: \& [buckets.test] \& encrypt = false .Ve -.Sp +.PP Under normal circumstances you don't need a configuration file. However, if you want to use different buckets, then this might be a handy option. Buckets are being configured in ini-style with the diff --git a/anydb.pod b/anydb.pod index 9b55677..6c8d874 100644 --- a/anydb.pod +++ b/anydb.pod @@ -526,7 +526,6 @@ term "bucket." followed by the bucket name. In the example above we enable encryption for the default bucket "data" and disable it for a bucket "test". To use different buckets, use the C<-b> option. -=back =head1 REST API diff --git a/cmd/anydb.go b/cmd/anydb.go index fc12f54..d8c36da 100644 --- a/cmd/anydb.go +++ b/cmd/anydb.go @@ -116,12 +116,12 @@ SUBCOMMANDS anydb set key -f file Values can be encrypted using ChaCha20Poly1305 when you specify the "-e" - option. Anydb will ask you interactively for a passphrase. You might as - well provide the passphrase using the environment variable - "ANYDB_PASSWORD". To encrypt the value, a cryptographically secure key - will be derived from the passphrase using the ArgonID2 algorithm. Each - value can be encrypted with another passphrase. So, the database itself - is not encrypted, just the values. + option. Anydb will ask you interactively for a passphrase. You can also + provide the passphrase using the environment variable "ANYDB_PASSWORD". + To encrypt the value, a cryptographically secure key will be derived + from the passphrase using the ArgonID2 algorithm. Each value can be + encrypted with another passphrase. So, the database itself is not + encrypted, just the values. You can supply tags by using the option "-t". Multiple tags can be provided either by separating them with a comma or by using multiple @@ -172,7 +172,7 @@ SUBCOMMANDS decrypt it. If the environment variable "ANYDB_PASSWORD" is set, its value will be used instead. - There are different output modes you can choos from: simple, wide and + There are different output modes you can choose from: simple, wide and json. The "simple" mode is the default one, it just prints the value as is. The "wide" mode prints a tabular output similar to the list subcommand, see there for more details. The options "-n" and "-N" have @@ -187,14 +187,16 @@ SUBCOMMANDS Usage: Usage: - anydb list [] [-t ] [-m ] [-n -N] [-T ] [flags] + anydb list [] [-t ] [-m ] [-n -N] [-T ] [-i] [flags] Aliases: list, /, ls Flags: + -i, --case-insensitive filter case insensitive -h, --help help for list - -m, --mode string output format (table|wide|json|template), wide is a verbose table. (default 'table') + -m, --mode string output format (table|wide|json|template), + wide is a verbose table. (default 'table') -n, --no-headers omit headers in tables -N, --no-human do not translate to human readable values -t, --tags stringArray tags, multiple allowed @@ -230,6 +232,8 @@ SUBCOMMANDS note, that this regexp dialect is not PCRE compatible, but supports most of its features. + If you want to search case insensitive, add the option "-i". + You can - as with the get command - use other output modes. The default mode is "table". The "wide" mode is, as already mentioned, a more detailed table. Also supported is "json" mode and "template" mode. For @@ -281,7 +285,7 @@ SUBCOMMANDS Please note, that this does not work with binary content! export - Since the bbold database file is not portable across platforms (it is + Since the bbolt database file is not portable across platforms (it is bound to the endianess of the CPU it was being created on), you might want to create a backup file of your database. You can do this with the export subcommand. @@ -402,8 +406,12 @@ TEMPLATES The following template variables can be used: - Key - string =item Value - string =item Bin - []byte =item Created - - time.Time =item Tags - []string =item Encrypted bool + Key - string + Value - string + Bin - []byte + Created - time.Time + Tags - []string + Encrypted bool Prepend a single dot (".") before each variable name. @@ -423,45 +431,46 @@ TEMPLATES anydb list -m template -T "{{ if .Tags }}{{ .Key }},{{ .Value }},{{ .Created}}{{ end }}" CONFIGURATION - Anydb looks at the following location for a configuration file, in that + Anydb looks at the following locations for a configuration file, in that order: "$HOME/.config/anydb/anydb.toml" "$HOME/.anydb.toml" "anydb.toml" in the current directory or specify one using "-c" - The configuration format uses the TOML language, refer to - for more details. The key names correspond to - the commandline options in most cases. - Configuration follows a certain precedence: the files are tried to - be read in the given order, followed by commandline options. That - is, the last configuration file wins, unless the user provides a - commandline option, then this setting will be taken. + The configuration format uses the TOML language, refer to + for more details. The key names correspond to the + commandline options in most cases. - A complete configuration file might look like this: + Configuration follows a certain precedence: the files are tried to be + read in the given order, followed by commandline options. That is, the + last configuration file wins, unless the user provides a commandline + option, then this setting will be taken. - # defaults - dbfile = "~/.config/anydb/default.db" - dbbucket = "data" - noheaders = false - nohumanize = false - encrypt = false - listen = "localhost:8787" + A complete configuration file might look like this: + + # defaults + dbfile = "~/.config/anydb/default.db" + dbbucket = "data" + noheaders = false + nohumanize = false + encrypt = false + listen = "localhost:8787" - # different setups for different buckets - [buckets.data] - encrypt = true + # different setups for different buckets + [buckets.data] + encrypt = true - [buckets.test] - encrypt = false + [buckets.test] + encrypt = false - Under normal circumstances you don't need a configuration file. - However, if you want to use different buckets, then this might be a - handy option. Buckets are being configured in ini-style with the - term "bucket." followed by the bucket name. In the example above we - enable encryption for the default bucket "data" and disable it for a - bucket "test". To use different buckets, use the "-b" option. + Under normal circumstances you don't need a configuration file. However, + if you want to use different buckets, then this might be a handy option. + Buckets are being configured in ini-style with the term "bucket." + followed by the bucket name. In the example above we enable encryption + for the default bucket "data" and disable it for a bucket "test". To use + different buckets, use the "-b" option. REST API The subcommand serve starts a simple HTTP service, which responds to