fixed copylocks linter warning

This commit is contained in:
2024-12-30 12:23:13 +01:00
parent 1eb5efae0c
commit 659e3472bb
5 changed files with 44 additions and 29 deletions

View File

@@ -234,6 +234,10 @@ SUBCOMMANDS
If you want to search case insensitive, add the option "-i".
By default anydb only searches through the keys. If you want to search
through the values as well, then use the "-s" option, which enables
full-text search.
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
@@ -293,7 +297,7 @@ SUBCOMMANDS
Usage:
Usage:
anydb export [-o <json filename>] [flags]
anydb export -o <json filename> [flags]
Aliases:
export, dump, backup
@@ -303,11 +307,11 @@ SUBCOMMANDS
-o, --output string output to file
The database dump is a JSON representation of the whole database and
will be printed to STDOUT by default. Redirect it to a file or use the
"-o" option:
will be printed to the file specified with the "-o" option. If you
specify "-" as the filename, it will be written to STDIN.
anydb export > dump.json
anydb export -o dump.json
anydb export -o - > dump.json
Please note, that encrypted values will not be decrypted. This might
change in a future version of anydb.
@@ -319,7 +323,7 @@ SUBCOMMANDS
Usage:
Usage:
anydb import [<json file>] [flags]
anydb import -i <json file> [flags]
Aliases:
import, restore
@@ -329,12 +333,13 @@ SUBCOMMANDS
-h, --help help for import
-t, --tags stringArray tags, multiple allowed
By default the "import" subcommand reads the JSON contents from STDIN.
You might pipe the dump into it or use the option "-r":
The "import" subcommand reads the JSON contents from the file specified
with the "-i" option. If you specify "-" as the filename, it will be
read from STDIN.
anydb import < dump.json
anydb import -r dump.json
cat dump.json | anydb import
anydb import -i - < dump.json
anydb import -i dump.json
cat dump.json | anydb import -i -
If there is already a database, it will be saved by appending a
timestamp and a new database with the contents of the dump will be

View File

@@ -56,7 +56,9 @@ func Export(conf *cfg.Config) *cobra.Command {
}
cmd.PersistentFlags().StringVarP(&attr.File, "output-file", "o", "", "filename or - for STDIN")
cmd.MarkPersistentFlagRequired("output-file")
if err := cmd.MarkPersistentFlagRequired("output-file"); err != nil {
panic(err)
}
cmd.Aliases = append(cmd.Aliases, "dump")
cmd.Aliases = append(cmd.Aliases, "backup")
@@ -88,8 +90,10 @@ func Import(conf *cfg.Config) *cobra.Command {
}
cmd.PersistentFlags().StringVarP(&attr.File, "import-file", "i", "", "filename or - for STDIN")
cmd.MarkPersistentFlagRequired("import-file")
cmd.PersistentFlags().StringArrayVarP(&attr.Tags, "tags", "t", nil, "tags, multiple allowed")
if err := cmd.MarkPersistentFlagRequired("import-file"); err != nil {
panic(err)
}
cmd.Aliases = append(cmd.Aliases, "restore")