From 6c90bd40bd1ae96617727e4c1b033b6cde79faf4 Mon Sep 17 00:00:00 2001 From: Hannes Laimer Date: Wed, 1 Mar 2023 07:50:45 +0100 Subject: [PATCH] kdb-cli: rewrite meta-set ... and (partial) fix #3742 --- doc/GETSTARTED.md | 4 +- doc/help/elektra-cascading.md | 2 +- doc/help/kdb-get.md | 2 +- doc/help/kdb-meta-set.md | 10 +- doc/help/kdb-meta-show.md | 8 +- doc/man/man1/kdb-get.1 | 2 +- doc/man/man1/kdb-meta-set.1 | 10 +- doc/man/man1/kdb-meta-show.1 | 8 +- doc/man/man7/elektra-cascading.7 | 4 +- doc/todo/PLUGINS | 2 +- doc/todo/TOOLS | 2 +- doc/tutorials/application-integration.md | 4 +- doc/tutorials/arrays.md | 6 +- doc/tutorials/cascading.md | 6 +- doc/tutorials/crypto.md | 8 +- doc/tutorials/dockerd-specification.md | 46 ++++----- doc/tutorials/external-commands.md | 24 ++--- doc/tutorials/merge.md | 18 ++-- doc/tutorials/mount.md | 10 +- doc/tutorials/specification.md | 70 +++++++------- doc/tutorials/storage-plugins.md | 8 +- doc/tutorials/validation.md | 20 ++-- scripts/configure-firefox.in | 16 ++-- scripts/ffconfig/setupProxy | 2 +- src/plugins/base64/README.md | 2 +- src/plugins/blacklist/README.md | 14 +-- src/plugins/conditionals/README.md | 6 +- src/plugins/crypto/README.md | 2 +- src/plugins/directoryvalue/README.md | 2 +- src/plugins/email/README.md | 2 +- src/plugins/error/README.md | 4 +- src/plugins/gpgme/README.md | 2 +- src/plugins/hexnumber/README.md | 8 +- src/plugins/ipaddr/README.md | 4 +- src/plugins/length/README.md | 2 +- src/plugins/macaddr/README.md | 8 +- src/plugins/mathcheck/README.md | 6 +- src/plugins/mini/README.md | 2 +- src/plugins/mmapstorage/README.md | 2 +- src/plugins/mozprefs/README.md | 6 +- src/plugins/mozprefs/autoconfig/README.md | 8 +- src/plugins/network/README.md | 4 +- src/plugins/ni/README.md | 9 +- src/plugins/path/README.md | 12 +-- src/plugins/process/README.md | 6 +- src/plugins/python/python/dns/README.md | 2 +- .../python/python/dns/src/main/dns_plugin.py | 2 +- src/plugins/quickdump/README.md | 2 +- src/plugins/range/README.md | 4 +- src/plugins/reference/README.md | 2 +- src/plugins/rgbcolor/README.md | 4 +- src/plugins/spec/README.md | 22 ++--- src/plugins/specload/README.md | 2 +- src/plugins/toml/README.md | 66 ++++++------- src/plugins/type/README.md | 30 +++--- src/plugins/xerces/README.md | 4 +- src/plugins/yajl/README.md | 6 +- src/plugins/yamlcpp/README.md | 22 ++--- src/tools/kdb/factory.hpp | 2 - src/tools/kdb/main.c | 2 - src/tools/kdb/meta-get.c | 2 +- src/tools/kdb/meta-set.c | 86 +++++++++++++++-- src/tools/kdb/meta-set.h | 4 +- src/tools/kdb/meta.c | 4 +- src/tools/kdb/metaset.cpp | 95 ------------------- src/tools/kdb/metaset.hpp | 48 ---------- tests/shell/check_error.sh | 2 +- tests/shell/check_merge.sh | 6 +- tests/shell/check_spec.sh | 2 +- tests/shell/check_spec_set.sh | 2 +- tests/shell/external/example_codegen_econf.sh | 2 +- .../example_codegen_econf_empty_array_spec.sh | 2 +- tests/shell/external/example_codegen_menu.sh | 6 +- tests/shell/external/example_codegen_tree.sh | 8 +- tests/shell/external/example_highlevel.sh | 2 +- .../shell/gen/highlevel/externalspec.check.sh | 2 +- .../highlevel/externalwithdefaults.check.sh | 2 +- tests/shell/gen/highlevel/nosetter.check.sh | 2 +- tests/shell/gen/highlevel/simple.check.sh | 2 +- tests/shell/shell_recorder/CMakeLists.txt | 1 + .../shell_recorder/cli/cli_external_spec.esr | 26 ++--- .../shell/shell_recorder/cli/cli_meta_set.esr | 50 ++++++++++ tests/shell/shell_recorder/mathcheck.esr | 16 ++-- tests/shell/shell_recorder/record.esr | 4 +- tests/shell/shell_recorder/script.esr | 2 +- 85 files changed, 470 insertions(+), 483 deletions(-) delete mode 100644 src/tools/kdb/metaset.cpp delete mode 100644 src/tools/kdb/metaset.hpp create mode 100644 tests/shell/shell_recorder/cli/cli_meta_set.esr diff --git a/doc/GETSTARTED.md b/doc/GETSTARTED.md index 55a5c37aa6f..a88bea2f534 100644 --- a/doc/GETSTARTED.md +++ b/doc/GETSTARTED.md @@ -121,7 +121,7 @@ Note that the value is empty since we just want to specify the key. Now let's show the actual power of Elektra by setting metadata to our specification: ```sh -sudo kdb meta-set "spec:/example/hello/what" default World +sudo kdb meta set "spec:/example/hello/what" default World ``` The metakey `default` (having the value `World`) is now associated with the key `spec:/example/hello/what`. @@ -130,7 +130,7 @@ It should be noted that the previous setting of `what` is in this scenario redun Now let's mount our specification: ```sh -sudo kdb meta-set "spec:/example/hello" mountpoint "hello.ni" +sudo kdb meta set "spec:/example/hello" mountpoint "hello.ni" sudo kdb spec-mount "/example/hello" ni ``` diff --git a/doc/help/elektra-cascading.md b/doc/help/elektra-cascading.md index 830b2152467..919df3d0152 100644 --- a/doc/help/elektra-cascading.md +++ b/doc/help/elektra-cascading.md @@ -35,7 +35,7 @@ They can be used like this: ```sh kdb set /overrides/test "example override" -sudo kdb meta-set spec:/test override/#0 /overrides/test +sudo kdb meta set spec:/test override/#0 /overrides/test ``` ## CASCADING diff --git a/doc/help/kdb-get.md b/doc/help/kdb-get.md index e3130be8e69..7cda2ed6b49 100644 --- a/doc/help/kdb-get.md +++ b/doc/help/kdb-get.md @@ -61,7 +61,7 @@ sudo kdb mount get.ecf spec:/tests/get/examples/kdb-get dump # Create the keys we use for the examples kdb set user:/tests/get/examples/kdb-get/key myKey -kdb meta-set spec:/tests/get/examples/kdb-get/anotherKey default defaultValue +kdb meta set spec:/tests/get/examples/kdb-get/anotherKey default defaultValue # To get the value of a key: kdb get user:/tests/get/examples/kdb-get/key diff --git a/doc/help/kdb-meta-set.md b/doc/help/kdb-meta-set.md index 31e95f03653..c93300aba70 100644 --- a/doc/help/kdb-meta-set.md +++ b/doc/help/kdb-meta-set.md @@ -2,7 +2,7 @@ ## SYNOPSIS -`kdb meta-set []` +`kdb meta set []` Where `key name` is the name of the key that the metakey is associated with, `metaname` is the name of the metakey the user would like to set the value of (or create), @@ -56,23 +56,23 @@ This command will return the following values as an exit status:
## EXAMPLES To set a metakey called `description` associated with the key `user:/example/key` to the value `Hello World!`:
-`kdb meta-set spec:/example/key description "Hello World!"` +`kdb meta set spec:/example/key description "Hello World!"` To create a new key `spec:/example/newkey` with a null value (if it did not exist before) and a metakey `namespace/#0` associated with it to the value `system`:
-`kdb meta-set /example/newkey "namespace/#0" system` +`kdb meta set /example/newkey "namespace/#0" system` To create an override link for a `/test` key: ```sh kdb set /overrides/test "example override" -sudo kdb meta-set spec:/test override/#0 /overrides/test +sudo kdb meta set spec:/test override/#0 /overrides/test ``` To remove it: ```sh -sudo kdb meta-set spec:/test override/#0 +sudo kdb meta set spec:/test override/#0 ``` ## SEE ALSO diff --git a/doc/help/kdb-meta-show.md b/doc/help/kdb-meta-show.md index 59f8b77d5b3..31198870720 100644 --- a/doc/help/kdb-meta-show.md +++ b/doc/help/kdb-meta-show.md @@ -55,10 +55,10 @@ sudo kdb mount ls.ecf user:/tests/examples dump # Create the keys we use for the examples kdb set user:/tests/examples/kdb-meta-show test -kdb meta-set user:/tests/examples/kdb-meta-show meta1 val1 -kdb meta-set user:/tests/examples/kdb-meta-show meta2 val2 -kdb meta-set user:/tests/examples/kdb-meta-show meta3 val3 -kdb meta-set user:/tests/examples/kdb-meta-show meta4 val4 +kdb meta set user:/tests/examples/kdb-meta-show meta1 val1 +kdb meta set user:/tests/examples/kdb-meta-show meta2 val2 +kdb meta set user:/tests/examples/kdb-meta-show meta3 val3 +kdb meta set user:/tests/examples/kdb-meta-show meta4 val4 # list all meta keys for /tests/examples/kdb-meta-show kdb meta-show /tests/examples/kdb-meta-show diff --git a/doc/man/man1/kdb-get.1 b/doc/man/man1/kdb-get.1 index 259875fa599..df1ef02e408 100644 --- a/doc/man/man1/kdb-get.1 +++ b/doc/man/man1/kdb-get.1 @@ -57,7 +57,7 @@ sudo kdb mount get\.ecf spec:/tests/get/examples/kdb\-get dump # Create the keys we use for the examples kdb set user:/tests/get/examples/kdb\-get/key myKey -kdb meta\-set spec:/tests/get/examples/kdb\-get/anotherKey default defaultValue +kdb meta set spec:/tests/get/examples/kdb\-get/anotherKey default defaultValue # To get the value of a key: kdb get user:/tests/get/examples/kdb\-get/key diff --git a/doc/man/man1/kdb-meta-set.1 b/doc/man/man1/kdb-meta-set.1 index 67b0de4fff2..e0bd22b4491 100644 --- a/doc/man/man1/kdb-meta-set.1 +++ b/doc/man/man1/kdb-meta-set.1 @@ -4,7 +4,7 @@ .SH "NAME" \fBkdb\-meta\-set\fR \- Set the value of a metakey .SH "SYNOPSIS" -\fBkdb meta\-set []\fR +\fBkdb meta set []\fR .P Where \fBkey name\fR is the name of the key that the metakey is associated with, \fBmetaname\fR is the name of the metakey the user would like to set the value of (or create), and \fBmetavalue\fR is the value the user wishes to set the metakey to\. If no \fBmetavalue\fR is given, the metakey will be removed\. .SH "DESCRIPTION" @@ -55,24 +55,24 @@ Same as \fB\-q\fR: Suppress default messages\. .SH "EXAMPLES" To set a metakey called \fBdescription\fR associated with the key \fBuser:/example/key\fR to the value \fBHello World!\fR: .br -\fBkdb meta\-set spec:/example/key description "Hello World!"\fR +\fBkdb meta set spec:/example/key description "Hello World!"\fR .P To create a new key \fBspec:/example/newkey\fR with a null value (if it did not exist before) and a metakey \fBnamespace/#0\fR associated with it to the value \fBsystem\fR: .br -\fBkdb meta\-set /example/newkey "namespace/#0" system\fR +\fBkdb meta set /example/newkey "namespace/#0" system\fR .P To create an override link for a \fB/test\fR key: .IP "" 4 .nf kdb set /overrides/test "example override" -sudo kdb meta\-set spec:/test override/#0 /overrides/test +sudo kdb meta set spec:/test override/#0 /overrides/test .fi .IP "" 0 .P To remove it: .IP "" 4 .nf -sudo kdb meta\-set spec:/test override/#0 +sudo kdb meta set spec:/test override/#0 .fi .IP "" 0 .SH "SEE ALSO" diff --git a/doc/man/man1/kdb-meta-show.1 b/doc/man/man1/kdb-meta-show.1 index 4dff389a6cc..31226b0e43b 100644 --- a/doc/man/man1/kdb-meta-show.1 +++ b/doc/man/man1/kdb-meta-show.1 @@ -55,10 +55,10 @@ sudo kdb mount ls\.ecf user:/tests/examples dump # Create the keys we use for the examples kdb set user:/tests/examples/kdb\-meta\-show test -kdb meta\-set user:/tests/examples/kdb\-meta\-show meta1 val1 -kdb meta\-set user:/tests/examples/kdb\-meta\-show meta2 val2 -kdb meta\-set user:/tests/examples/kdb\-meta\-show meta3 val3 -kdb meta\-set user:/tests/examples/kdb\-meta\-show meta4 val4 +kdb meta set user:/tests/examples/kdb\-meta\-show meta1 val1 +kdb meta set user:/tests/examples/kdb\-meta\-show meta2 val2 +kdb meta set user:/tests/examples/kdb\-meta\-show meta3 val3 +kdb meta set user:/tests/examples/kdb\-meta\-show meta4 val4 # list all meta keys for /tests/examples/kdb\-meta\-show kdb meta\-show /tests/examples/kdb\-meta\-show diff --git a/doc/man/man7/elektra-cascading.7 b/doc/man/man7/elektra-cascading.7 index 658eb8a36b8..25a9988289e 100644 --- a/doc/man/man7/elektra-cascading.7 +++ b/doc/man/man7/elektra-cascading.7 @@ -1,6 +1,6 @@ .\" generated with Ronn-NG/v0.10.1 .\" http://github.com/apjanke/ronn-ng/tree/0.10.1.pre3 -.TH "ELEKTRA\-CASCADING" "7" "November 2021" "" +.TH "ELEKTRA\-CASCADING" "7" "May 2023" "" .SH "NAME" \fBelektra\-cascading\fR \- of key names .P @@ -25,7 +25,7 @@ They can be used like this: .IP "" 4 .nf kdb set /overrides/test "example override" -sudo kdb meta\-set spec:/test override/#0 /overrides/test +sudo kdb meta set spec:/test override/#0 /overrides/test .fi .IP "" 0 .SH "CASCADING" diff --git a/doc/todo/PLUGINS b/doc/todo/PLUGINS index 19bf4068072..8b1fdd6c322 100644 --- a/doc/todo/PLUGINS +++ b/doc/todo/PLUGINS @@ -73,7 +73,7 @@ logging API: implement semlock plugin, see commit bc8b5d66bd4babba6bc8c34804b966daf6878a1d inherit/copy metadata/bind mounts: - kdb meta-set spec:/something inherit/override/# '"/elsewhere/key/" + basename' + kdb meta set spec:/something inherit/override/# '"/elsewhere/key/" + basename' und ein inherit-Plugin kopiert dann automatisch ein override /elsewhere/key/ (mit dem richtigen basename dran) in alle Subkeys (die nicht ein anderes inherit/override haben). werror plugin: diff --git a/doc/todo/TOOLS b/doc/todo/TOOLS index 629c09031ee..7ceaf2bc4c1 100644 --- a/doc/todo/TOOLS +++ b/doc/todo/TOOLS @@ -92,7 +92,7 @@ generic fstab: allows kdb mset fstab to be the same as kdb fstab kdb tool should work with arrays (add_entry, remove_entry) - or also kdb meta-set user:/abc check/enum -a "first enum" "second enum" "third enum" + or also kdb meta set user:/abc check/enum -a "first enum" "second enum" "third enum" or also kdb set user:/abc -a "first array entry" "second" "third array entry" allow key array increments with kdb tool diff --git a/doc/tutorials/application-integration.md b/doc/tutorials/application-integration.md index f683a04f5b4..72f05f0836f 100644 --- a/doc/tutorials/application-integration.md +++ b/doc/tutorials/application-integration.md @@ -236,7 +236,7 @@ You can use those features like following: ```sh kdb set /overrides/test "example override" -sudo kdb meta-set spec:/test override/#0 /overrides/test +sudo kdb meta set spec:/test override/#0 /overrides/test ``` This technique provides complete transparency how a program will fetch a @@ -260,7 +260,7 @@ we want to use `/sw/otherorg/otherapp/#0/current/section/subsection/key`. So we specify: ```sh -kdb meta-set spec:/sw/org/myapp/#0/current/section/subsection/key \ +kdb meta set spec:/sw/org/myapp/#0/current/section/subsection/key \ "fallback/#0" /sw/otherorg/otherapp/#0/current/section/subsection/key ``` diff --git a/doc/tutorials/arrays.md b/doc/tutorials/arrays.md index 077581bcefe..914901454e2 100644 --- a/doc/tutorials/arrays.md +++ b/doc/tutorials/arrays.md @@ -51,7 +51,7 @@ For an **empty array** (`[]`) we just add the [metakey](../help/elektra-metadata ```sh # Create an empty array with the name `user:/tests/sequence` -kdb meta-set user:/tests/sequence array '' +kdb meta set user:/tests/sequence array '' ``` . @@ -100,7 +100,7 @@ This of course works only, if the plugins already stores this information in the - implicitly (e.g. the data below the array parent is stored as array/list/sequence in the config file), or - explicitly (e.g. the plugin stores the metakey `array` directly in the config file) -. Either way, in some situations you might have to add this value manually via `kdb meta-set`: +. Either way, in some situations you might have to add this value manually via `kdb meta set`: ```sh # Add array elements @@ -112,7 +112,7 @@ kdb set user:/tests/favorites/superheros/#99999 'The guy with the bow and arrow' #> Create a new key user:/tests/favorites/superheros/#____99999 with string "The guy with the bow and arrow" # The metakey `array` should save the basename of the last element. -kdb meta-set user:/tests/favorites/superheros array '#99999' +kdb meta set user:/tests/favorites/superheros array '#99999' ``` . This way you can always retrieve the last element of an array easily: diff --git a/doc/tutorials/cascading.md b/doc/tutorials/cascading.md index 86a2c449b0e..3fc568652d0 100644 --- a/doc/tutorials/cascading.md +++ b/doc/tutorials/cascading.md @@ -99,6 +99,10 @@ For example, kdb set /tests/tutorial/cascading/key1 "hello world" # RET: 2 # STDERR: .*key does not specify a namespace + +kdb meta set /tests/tutorial/cascading/key1 meta1 hello +# RET: 2 +# STDERR: .*key does not specify a namespace ``` ## Override Links @@ -136,7 +140,7 @@ sudo kdb set system:/tests/overrides/test "hello override" Override links can be defined by adding them to the `override/#` metadata array key of the corresponding `spec-key`: ```sh -sudo kdb meta-set spec:/tests/tutorial/cascading/#0/current/test override/#0 /tests/overrides/test +sudo kdb meta set spec:/tests/tutorial/cascading/#0/current/test override/#0 /tests/overrides/test ``` Now when doing a cascading lookup, we get the value of our target key instead of the specified one: diff --git a/doc/tutorials/crypto.md b/doc/tutorials/crypto.md index d8a228f234a..648e498ffcb 100644 --- a/doc/tutorials/crypto.md +++ b/doc/tutorials/crypto.md @@ -211,7 +211,7 @@ We want to protect the password, that is stored under `user:/test/password`. So we set the metakey as follows: ```bash -kdb meta-set user:/tests/password crypto/encrypt 1 +kdb meta set user:/tests/password crypto/encrypt 1 ``` Now we are safe to set the actual password: @@ -240,7 +240,7 @@ As a result you get "1234". You can disable the encryption by setting `crypto/encrypt` to a value other than `1`, for example: ```bash -kdb meta-set user:/tests/password crypto/encrypt 0 +kdb meta set user:/tests/password crypto/encrypt 0 ``` ### Complete Example @@ -249,7 +249,7 @@ The complete example looks like this: ```sh kdb mount test.ini user:/tests crypto "crypto/key=$(kdb gen-gpg-testkey)" base64 ini -kdb meta-set user:/tests/password crypto/encrypt 1 +kdb meta set user:/tests/password crypto/encrypt 1 kdb set user:/tests/password 1234 kdb set user:/tests/unencrypted "I am not encrypted" kdb file user:/tests/password | xargs cat @@ -258,7 +258,7 @@ kdb file user:/tests/password | xargs cat To disable encryption on `user:/tests/password`, we can run: ```sh -kdb meta-set user:/tests/password crypto/encrypt 0 +kdb meta set user:/tests/password crypto/encrypt 0 kdb file user:/tests/password | xargs cat ``` diff --git a/doc/tutorials/dockerd-specification.md b/doc/tutorials/dockerd-specification.md index 899335f9924..398c1acdb39 100644 --- a/doc/tutorials/dockerd-specification.md +++ b/doc/tutorials/dockerd-specification.md @@ -68,7 +68,7 @@ Next you can define, that this specification uses a specific mountpoint for a co So you can say the concrete configuration should be written to `dockerd.ini`. ```sh -kdb meta-set spec:/sw/dockerd/dockerd/#0/current mountpoint /docker/daemon.json +kdb meta set spec:/sw/dockerd/dockerd/#0/current mountpoint /docker/daemon.json # RET: 0 ``` @@ -93,7 +93,7 @@ Next we will define that our configuration should be written `json`. We can do this by running: ```sh -kdb meta-set spec:/sw/dockerd/dockerd/#0/current infos/plugin "yajl" +kdb meta set spec:/sw/dockerd/dockerd/#0/current infos/plugin "yajl" # RET: 0 ``` @@ -163,13 +163,13 @@ meta:/default = /var/lib/docker In order to get the above specification we will need the following commands: ```sh -kdb meta-set spec:/sw/docker/dockerd/#0/current/data/root type "string" +kdb meta set spec:/sw/docker/dockerd/#0/current/data/root type "string" # RET: 0 -kdb meta-set spec:/sw/docker/dockerd/#0/current/data/root description "Root directory of persistent Docker state" +kdb meta set spec:/sw/docker/dockerd/#0/current/data/root description "Root directory of persistent Docker state" # RET: 0 -kdb meta-set spec:/sw/docker/dockerd/#0/current/data/root default "/var/lib/docker" +kdb meta set spec:/sw/docker/dockerd/#0/current/data/root default "/var/lib/docker" # RET: 0 ``` @@ -202,19 +202,19 @@ meta:/check/enum/#1 = private In order to get the above specification we will need the following commands: ```sh -kdb meta-set spec:/sw/docker/dockerd/#0/current/default/cgroupns/mode description "Default mode for containers cgroup namespace" +kdb meta set spec:/sw/docker/dockerd/#0/current/default/cgroupns/mode description "Default mode for containers cgroup namespace" # RET: 0 -kdb meta-set spec:/sw/docker/dockerd/#0/current/default/cgroupns/mode default "private" +kdb meta set spec:/sw/docker/dockerd/#0/current/default/cgroupns/mode default "private" # RET: 0 -kdb meta-set spec:/sw/docker/dockerd/#0/current/default/cgroupns/mode check/enum "#1" +kdb meta set spec:/sw/docker/dockerd/#0/current/default/cgroupns/mode check/enum "#1" # RET: 0 -kdb meta-set spec:/sw/docker/dockerd/#0/current/default/cgroupns/mode check/enum/#0 "host" +kdb meta set spec:/sw/docker/dockerd/#0/current/default/cgroupns/mode check/enum/#0 "host" # RET: 0 -kdb meta-set spec:/sw/docker/dockerd/#0/current/default/cgroupns/mode check/enum/#1 "private" +kdb meta set spec:/sw/docker/dockerd/#0/current/default/cgroupns/mode check/enum/#1 "private" # RET: 0 ``` @@ -257,13 +257,13 @@ The name of the `ulimits` does not matter but all should have the same metakeys. In order to get the above specification we will need following commands: ```sh -kdb meta-set spec:/sw/docker/dockerd/#0/current/default/ulimits/_ type "long" +kdb meta set spec:/sw/docker/dockerd/#0/current/default/ulimits/_ type "long" # RET: 0 -kdb meta-set spec:/sw/docker/dockerd/#0/current/default/ulimits/_ description "Default ulimits for containers" +kdb meta set spec:/sw/docker/dockerd/#0/current/default/ulimits/_ description "Default ulimits for containers" # RET: 0 -kdb meta-set spec:/sw/docker/dockerd/#0/current/default/ulimits/_ example "64000" +kdb meta set spec:/sw/docker/dockerd/#0/current/default/ulimits/_ example "64000" # RET: 0 ``` @@ -331,28 +331,28 @@ It will fail as `default/address/pools/#/size` is required to be of type `short` In order to get the above specification we will need following commands: ```sh -kdb meta-set spec:/sw/docker/dockerd/#0/current/default/address/pools array/min "0" +kdb meta set spec:/sw/docker/dockerd/#0/current/default/address/pools array/min "0" # RET: 0 -kdb meta-set spec:/sw/docker/dockerd/#0/current/default/address/pools description "Default address pools for node specific local networks (list)" +kdb meta set spec:/sw/docker/dockerd/#0/current/default/address/pools description "Default address pools for node specific local networks (list)" # RET: 0 -kdb meta-set spec:/sw/docker/dockerd/#0/current/default/address/pools/#/base type "string" +kdb meta set spec:/sw/docker/dockerd/#0/current/default/address/pools/#/base type "string" # RET: 0 -kdb meta-set spec:/sw/docker/dockerd/#0/current/default/address/pools/#/base description "Ip address (ipv4) + subnet" +kdb meta set spec:/sw/docker/dockerd/#0/current/default/address/pools/#/base description "Ip address (ipv4) + subnet" # RET: 0 -kdb meta-set spec:/sw/docker/dockerd/#0/current/default/address/pools/#/base example "172.30.0.0/16" +kdb meta set spec:/sw/docker/dockerd/#0/current/default/address/pools/#/base example "172.30.0.0/16" # RET: 0 -kdb meta-set spec:/sw/docker/dockerd/#0/current/default/address/pools/#/size type "short" +kdb meta set spec:/sw/docker/dockerd/#0/current/default/address/pools/#/size type "short" # RET: 0 -kdb meta-set spec:/sw/docker/dockerd/#0/current/default/address/pools/#/size description "Number of ip addresses in this pool with base" +kdb meta set spec:/sw/docker/dockerd/#0/current/default/address/pools/#/size description "Number of ip addresses in this pool with base" # RET: 0 -kdb meta-set spec:/sw/docker/dockerd/#0/current/default/address/pools/#/size example "24" +kdb meta set spec:/sw/docker/dockerd/#0/current/default/address/pools/#/size example "24" # RET: 0 ``` @@ -386,8 +386,8 @@ Now we are going to add an example of [dockerd-full-spec](../../examples/spec/do Make sure you are in the root of the cloned `libelektra` repository: 1. `sudo kdb mount "$PWD/dockerd/dockerd-daemon.ni" spec:/sw/docker/dockerd/#0/current ni` -2. `kdb meta-set spec:/sw/dockerd/dockerd/#0/current mountpoint /dockerd/daemon.ni` -3. `kdb meta-set spec:/sw/dockerd/dockerd/#0/current infos/plugin "yajl"` +2. `kdb meta set spec:/sw/dockerd/dockerd/#0/current mountpoint /dockerd/daemon.ni` +3. `kdb meta set spec:/sw/dockerd/dockerd/#0/current infos/plugin "yajl"` 4. `sudo kdb spec-mount "/sw/docker/dockerd/#0/current"` 5. `sudo kdb import spec:/sw/docker/dockerd/#0/current ni < ./examples/spec/dockerd.ini` diff --git a/doc/tutorials/external-commands.md b/doc/tutorials/external-commands.md index 095abf550bd..05fbe9f038b 100644 --- a/doc/tutorials/external-commands.md +++ b/doc/tutorials/external-commands.md @@ -3,7 +3,7 @@ This tutorial will describe how to provide `kdb` with the specification of external programs. So `kdb` can parse and check the provided options and arguments according to the provided specification. This allows you to have, for example, a shell script but its args are checked by `kdb` before running it. -It is possible to either mount(`kdb mount`) the specification, or set the keys manually using `kdb set` and `kdb meta-set`. +It is possible to either mount(`kdb mount`) the specification, or set the keys manually using `kdb set` and `kdb meta set`. Both options will be described in the following. Here we'll define the specification for a simple script that removes files by moving them to a trash folder instead of directly deleting them. @@ -94,19 +94,19 @@ This is the same as mounting the spec file. ```bash kdb set spec:/sw/elektra/kdb/#0/current/trash "" -kdb meta-set spec:/sw/elektra/kdb/#0/current/trash external 1 -kdb meta-set spec:/sw/elektra/kdb/#0/current/trash bin "/path/to/trash.sh" -kdb meta-set spec:/sw/elektra/kdb/#0/current/trash command "trash" -kdb meta-set spec:/sw/elektra/kdb/#0/current/trash description "Move a file to trash" +kdb meta set spec:/sw/elektra/kdb/#0/current/trash external 1 +kdb meta set spec:/sw/elektra/kdb/#0/current/trash bin "/path/to/trash.sh" +kdb meta set spec:/sw/elektra/kdb/#0/current/trash command "trash" +kdb meta set spec:/sw/elektra/kdb/#0/current/trash description "Move a file to trash" kdb set spec:/sw/elektra/kdb/#0/current/trash/file "" -kdb meta-set spec:/sw/elektra/kdb/#0/current/trash/file description "The file that should be moved to trash" -kdb meta-set spec:/sw/elektra/kdb/#0/current/trash/file args indexed -kdb meta-set spec:/sw/elektra/kdb/#0/current/trash/file args/index 0 +kdb meta set spec:/sw/elektra/kdb/#0/current/trash/file description "The file that should be moved to trash" +kdb meta set spec:/sw/elektra/kdb/#0/current/trash/file args indexed +kdb meta set spec:/sw/elektra/kdb/#0/current/trash/file args/index 0 kdb set spec:/sw/elektra/kdb/#0/current/trash/force "" -kdb meta-set spec:/sw/elektra/kdb/#0/current/trash/force description "Delete the file directly" -kdb meta-set spec:/sw/elektra/kdb/#0/current/trash/force opt f -kdb meta-set spec:/sw/elektra/kdb/#0/current/trash/force opt/long force -kdb meta-set spec:/sw/elektra/kdb/#0/current/trash/force opt/arg none +kdb meta set spec:/sw/elektra/kdb/#0/current/trash/force description "Delete the file directly" +kdb meta set spec:/sw/elektra/kdb/#0/current/trash/force opt f +kdb meta set spec:/sw/elektra/kdb/#0/current/trash/force opt/long force +kdb meta set spec:/sw/elektra/kdb/#0/current/trash/force opt/arg none ``` > **_NOTE:_** Extra arguments are directly passed on to the external command. So it is possible to provide the external program with more diff --git a/doc/tutorials/merge.md b/doc/tutorials/merge.md index 4a5e0e357a1..e5d74d8ca68 100644 --- a/doc/tutorials/merge.md +++ b/doc/tutorials/merge.md @@ -133,21 +133,21 @@ We set up some keys: ```sh kdb set user:/tests/meta/base equal #> Create a new key user:/tests/meta/base with string "equal" -kdb meta-set user:/tests/meta/base comment/#0 "This is the original inline comment" -kdb meta-set user:/tests/meta/base comment/#1 "This is the first line of the original comment above the key" -kdb meta-set user:/tests/meta/base comment/#2 "This is the second line of the original comment above the key" +kdb meta set user:/tests/meta/base comment/#0 "This is the original inline comment" +kdb meta set user:/tests/meta/base comment/#1 "This is the first line of the original comment above the key" +kdb meta set user:/tests/meta/base comment/#2 "This is the second line of the original comment above the key" kdb set user:/tests/meta/their equal #> Create a new key user:/tests/meta/their with string "equal" -kdb meta-set user:/tests/meta/their comment/#0 "This is their inline comment" -kdb meta-set user:/tests/meta/their comment/#1 "This is the first line of their comment above the key" -kdb meta-set user:/tests/meta/their comment/#2 "This is the second line of their comment above the key" +kdb meta set user:/tests/meta/their comment/#0 "This is their inline comment" +kdb meta set user:/tests/meta/their comment/#1 "This is the first line of their comment above the key" +kdb meta set user:/tests/meta/their comment/#2 "This is the second line of their comment above the key" kdb set user:/tests/meta/our equal #> Create a new key user:/tests/meta/our with string "equal" -kdb meta-set user:/tests/meta/our comment/#0 "This is your custom inline comment" -kdb meta-set user:/tests/meta/our comment/#1 "This is the first line of your custom comment above the key" -kdb meta-set user:/tests/meta/our comment/#2 "This is the second line of your custom comment above the key" +kdb meta set user:/tests/meta/our comment/#0 "This is your custom inline comment" +kdb meta set user:/tests/meta/our comment/#1 "This is the first line of your custom comment above the key" +kdb meta set user:/tests/meta/our comment/#2 "This is the second line of your custom comment above the key" kdb merge user:/tests/meta/our user:/tests/meta/their user:/tests/meta/base user:/tests/meta/metaFromOur ``` diff --git a/doc/tutorials/mount.md b/doc/tutorials/mount.md index dc578a5d9ff..8c3c619de67 100644 --- a/doc/tutorials/mount.md +++ b/doc/tutorials/mount.md @@ -168,11 +168,11 @@ By entering `kdb plugin-info type` in the commandline, we can find out how to us It turns out that this plugin allows us to define a list of valid values for our keys via the metavalue `check/enum`. ```sh -kdb meta-set user:/example/enumtest/fruit check/enum "#2" -kdb meta-set user:/example/enumtest/fruit check/enum/#0 apple -kdb meta-set user:/example/enumtest/fruit check/enum/#1 banana -kdb meta-set user:/example/enumtest/fruit check/enum/#2 grape -kdb meta-set user:/example/enumtest/fruit check/type enum +kdb meta set user:/example/enumtest/fruit check/enum "#2" +kdb meta set user:/example/enumtest/fruit check/enum/#0 apple +kdb meta set user:/example/enumtest/fruit check/enum/#1 banana +kdb meta set user:/example/enumtest/fruit check/enum/#2 grape +kdb meta set user:/example/enumtest/fruit check/type enum kdb set user:/example/enumtest/fruit tomato # RET:5 # this fails because tomato is not in the list of valid values diff --git a/doc/tutorials/specification.md b/doc/tutorials/specification.md index 5d83df8b80a..3a83f6e08c3 100644 --- a/doc/tutorials/specification.md +++ b/doc/tutorials/specification.md @@ -96,7 +96,7 @@ Next you can define, that this specification uses a specific mountpoint for a co So you can say the concrete configuration should be written to `app.ni`. ```sh -kdb meta-set spec:/tests/sw/org/app/\#0/current mountpoint app.ni +kdb meta set spec:/tests/sw/org/app/\#0/current mountpoint app.ni ``` Your `spec.ni` file should now look something like this: @@ -152,7 +152,7 @@ The first key you will add to your specification is the port of the server. You add it by using the following command: ```sh -kdb meta-set spec:/tests/sw/org/app/\#0/current/server/port type unsigned_short +kdb meta set spec:/tests/sw/org/app/\#0/current/server/port type unsigned_short ``` What you also specified in the command above is the type of the configuration value. Elektra uses the [CORBA type system](https://www.libelektra.org/plugins/type) @@ -184,9 +184,9 @@ What about a `default`, or what about an `example` for a usable port? Maybe a `d Let's add that next! ```sh -kdb meta-set spec:/tests/sw/org/app/\#0/current/server/port default 8080 -kdb meta-set spec:/tests/sw/org/app/\#0/current/server/port example 8080 -kdb meta-set spec:/tests/sw/org/app/\#0/current/server/port description "port of the REST server that runs the application" +kdb meta set spec:/tests/sw/org/app/\#0/current/server/port default 8080 +kdb meta set spec:/tests/sw/org/app/\#0/current/server/port example 8080 +kdb meta set spec:/tests/sw/org/app/\#0/current/server/port description "port of the REST server that runs the application" ``` Beautiful! Your specification is starting to look like something useful. @@ -195,7 +195,7 @@ But wait! Shouldn't a port just use values between `1` and `65535`? Of course Elektra also has a plugin for that. You can just use the [network](https://www.libelektra.org/plugins/network) checker plugin. ```sh -kdb meta-set spec:/tests/sw/org/app/\#0/current/server/port check/port '' +kdb meta set spec:/tests/sw/org/app/\#0/current/server/port check/port '' ``` Now we define the plugins that we want to load. @@ -203,7 +203,7 @@ In our example we need the `ni`-Plugin for reading and writing the configuration the `type`-plugin for validating data types and the `network`-plugin for validating port numbers. ```sh -kdb meta-set spec:/tests/sw/org/app/\#0/current infos/plugins "ni type network" +kdb meta set spec:/tests/sw/org/app/\#0/current infos/plugins "ni type network" ``` Nice! @@ -270,10 +270,10 @@ Next up you will configure the `secure` property of our server. This boolean key So we will add the key and some metadata for it: ```sh -kdb meta-set spec:/tests/sw/org/app/\#0/current/server/secure type boolean -kdb meta-set spec:/tests/sw/org/app/\#0/current/server/secure default 1 -kdb meta-set spec:/tests/sw/org/app/\#0/current/server/secure example 0 -kdb meta-set spec:/tests/sw/org/app/\#0/current/server/secure description "true if the REST server uses SSL for communication" +kdb meta set spec:/tests/sw/org/app/\#0/current/server/secure type boolean +kdb meta set spec:/tests/sw/org/app/\#0/current/server/secure default 1 +kdb meta set spec:/tests/sw/org/app/\#0/current/server/secure example 0 +kdb meta set spec:/tests/sw/org/app/\#0/current/server/secure description "true if the REST server uses SSL for communication" ``` By default the `type` plugin will normalize boolean values when setting them, before storing them. @@ -345,11 +345,11 @@ database/ip = Alternatively you can of course use `kdb` again to set the configuration values that way. Here are the commands to do that. ```sh -kdb meta-set spec:/tests/sw/org/app/\#0/current/database/ip type string -kdb meta-set spec:/tests/sw/org/app/\#0/current/database/ip default 127.0.0.1 -kdb meta-set spec:/tests/sw/org/app/\#0/current/database/ip example 127.0.0.1 -kdb meta-set spec:/tests/sw/org/app/\#0/current/database/ip description "ip address of the database server, that the application will connect to" -kdb meta-set spec:/tests/sw/org/app/\#0/current/database/ip check/ipaddr '' +kdb meta set spec:/tests/sw/org/app/\#0/current/database/ip type string +kdb meta set spec:/tests/sw/org/app/\#0/current/database/ip default 127.0.0.1 +kdb meta set spec:/tests/sw/org/app/\#0/current/database/ip example 127.0.0.1 +kdb meta set spec:/tests/sw/org/app/\#0/current/database/ip description "ip address of the database server, that the application will connect to" +kdb meta set spec:/tests/sw/org/app/\#0/current/database/ip check/ipaddr '' ``` ### Step 2: Adding the database dialect @@ -361,24 +361,24 @@ This allows us to prohibit all other possible dialects that are not SQL. First you define the size of the `enum` type, and then you can add the different `enum` values. ```sh -kdb meta-set spec:/tests/sw/org/app/\#0/current/database/dialect type enum -kdb meta-set spec:/tests/sw/org/app/\#0/current/database/dialect check/enum "#4" -kdb meta-set spec:/tests/sw/org/app/\#0/current/database/dialect check/enum/\#0 postgresql -kdb meta-set spec:/tests/sw/org/app/\#0/current/database/dialect check/enum/\#1 mysql -kdb meta-set spec:/tests/sw/org/app/\#0/current/database/dialect check/enum/\#2 mssql -kdb meta-set spec:/tests/sw/org/app/\#0/current/database/dialect check/enum/\#3 mariadb -kdb meta-set spec:/tests/sw/org/app/\#0/current/database/dialect check/enum/\#4 sqlite +kdb meta set spec:/tests/sw/org/app/\#0/current/database/dialect type enum +kdb meta set spec:/tests/sw/org/app/\#0/current/database/dialect check/enum "#4" +kdb meta set spec:/tests/sw/org/app/\#0/current/database/dialect check/enum/\#0 postgresql +kdb meta set spec:/tests/sw/org/app/\#0/current/database/dialect check/enum/\#1 mysql +kdb meta set spec:/tests/sw/org/app/\#0/current/database/dialect check/enum/\#2 mssql +kdb meta set spec:/tests/sw/org/app/\#0/current/database/dialect check/enum/\#3 mariadb +kdb meta set spec:/tests/sw/org/app/\#0/current/database/dialect check/enum/\#4 sqlite ``` Afterwards you define all the other parameters, just as before. ```sh -kdb meta-set spec:/tests/sw/org/app/\#0/current/database/dialect default sqlite -kdb meta-set spec:/tests/sw/org/app/\#0/current/database/dialect example mysql -kdb meta-set spec:/tests/sw/org/app/\#0/current/database/dialect description "SQL dialect of the database server, that the application will connect to" +kdb meta set spec:/tests/sw/org/app/\#0/current/database/dialect default sqlite +kdb meta set spec:/tests/sw/org/app/\#0/current/database/dialect example mysql +kdb meta set spec:/tests/sw/org/app/\#0/current/database/dialect description "SQL dialect of the database server, that the application will connect to" ``` -After this meta-setting bonanza your specification file should look something like this: +After this meta setting bonanza your specification file should look something like this: ```sh cat $(kdb file spec:/tests/sw/org/app/\#0/current) @@ -437,23 +437,23 @@ You also specify a `check/date/format`. You can find all possible date formats o For this you can use the following commands: ``` -kdb meta-set spec:/tests/sw/org/app/\#0/current/backup/date type string -kdb meta-set spec:/tests/sw/org/app/\#0/current/backup/date check/date ISO8601 -kdb meta-set spec:/tests/sw/org/app/\#0/current/backup/date check/date/format "calendardate complete extended" +kdb meta set spec:/tests/sw/org/app/\#0/current/backup/date type string +kdb meta set spec:/tests/sw/org/app/\#0/current/backup/date check/date ISO8601 +kdb meta set spec:/tests/sw/org/app/\#0/current/backup/date check/date/format "calendardate complete extended" ``` Then just add examples, defaults and description as always. ``` -kdb meta-set spec:/tests/sw/org/app/\#0/current/backup/date default 2021-11-01 -kdb meta-set spec:/tests/sw/org/app/\#0/current/backup/date example 2021-01-12 -kdb meta-set spec:/tests/sw/org/app/\#0/current/backup/date description "date of the annual server and database backup" +kdb meta set spec:/tests/sw/org/app/\#0/current/backup/date default 2021-11-01 +kdb meta set spec:/tests/sw/org/app/\#0/current/backup/date example 2021-01-12 +kdb meta set spec:/tests/sw/org/app/\#0/current/backup/date description "date of the annual server and database backup" ``` Now we add the validation plugin for dates and remount the specification: ``` -kdb meta-set spec:/tests/sw/org/app/\#0/current infos/plugins "ni type network date" +kdb meta set spec:/tests/sw/org/app/\#0/current infos/plugins "ni type network date" sudo kdb spec-mount /tests/sw/org/app/\#0/current ``` @@ -675,7 +675,7 @@ please refer to [the man page of kdb reset](https://www.libelektra.org/man-pages ## Summary - You set up and mounted a specification using `kdb mount` and `kdb spec-mount`. -- You added keys to the specification using `kdb meta-set`. +- You added keys to the specification using `kdb meta set`. - You added different types of keys with `type string`, `type boolean` or `type unsigned_short`. - You added keys with `enum types`, to restrict specific configuration settings to a defined set of possible values. - You added default parameters, examples and descriptions with `example`, `default`, `description`. diff --git a/doc/tutorials/storage-plugins.md b/doc/tutorials/storage-plugins.md index 620b8ce211e..a2f54f81701 100644 --- a/doc/tutorials/storage-plugins.md +++ b/doc/tutorials/storage-plugins.md @@ -77,7 +77,7 @@ In the test we also use the [`type` plugin](../../src/plugins/type/README.md) to sudo kdb mount config.yaml user:/tests/storage yamlcpp type kdb set user:/tests/storage/bool/value true -kdb meta-set user:/tests/storage/bool/value type boolean +kdb meta set user:/tests/storage/bool/value type boolean kdb get user:/tests/storage/bool/value #> 1 @@ -188,7 +188,7 @@ are normal key-value pairs. The following example shows that the storage plugin sudo kdb mount config.yaml user:/tests/storage yamlcpp # Create an array containing two elements -kdb meta-set user:/tests/storage/array array '' +kdb meta set user:/tests/storage/array array '' kdb set user:/tests/storage/array/#0 one kdb set user:/tests/storage/array/#1 two @@ -286,8 +286,8 @@ cat `kdb file user:/tests/hosts` #> 127.0.0.1 localhost.2 # setting the correct order -kdb meta-set user:/tests/hosts/ipv4/localhost.4 order 4 -kdb meta-set user:/tests/hosts/ipv4/localhost.3 order 3 +kdb meta set user:/tests/hosts/ipv4/localhost.4 order 4 +kdb meta set user:/tests/hosts/ipv4/localhost.3 order 3 # lines in hosts file are also in correct order afterwards cat `kdb file user:/tests/hosts` diff --git a/doc/tutorials/validation.md b/doc/tutorials/validation.md index eea8ddcb7c0..614617e3d74 100644 --- a/doc/tutorials/validation.md +++ b/doc/tutorials/validation.md @@ -35,9 +35,9 @@ described in this tutorial, e.g.: The most direct way to validate keys is ```sh -kdb meta-set user:/tests/together/test check/validation "[1-9][0-9]*" -kdb meta-set user:/tests/together/test check/validation/match LINE -kdb meta-set user:/tests/together/test check/validation/message "Not a number" +kdb meta set user:/tests/together/test check/validation "[1-9][0-9]*" +kdb meta set user:/tests/together/test check/validation/match LINE +kdb meta set user:/tests/together/test check/validation/message "Not a number" kdb set user:/tests/together/test 123 #> Set string to "123" @@ -86,7 +86,7 @@ kdb export user:/ dump > $(kdb get system:/tests/userbackup) We write metadata to the namespace `spec` and the plugin `spec` applies it to every cascading key: ```sh -kdb meta-set spec:/tests/spec/test hello world +kdb meta set spec:/tests/spec/test hello world kdb set user:/tests/spec/test value kdb meta-ls spec:/tests/spec/test | grep -v '^internal/ini' #> hello @@ -99,7 +99,7 @@ kdb meta get /tests/spec/test hello But it also supports globbing (`_` for any key, `?` for any char, `[]` for character classes): ```sh -kdb meta-set "spec:/tests/spec/_" new metaval +kdb meta set "spec:/tests/spec/_" new metaval kdb set user:/tests/spec/test value kdb meta-ls /tests/spec/test | grep -v '^internal/ini' #> hello @@ -114,9 +114,9 @@ So let us combine this functionality with validation plugins. So we would specify: ```sh -kdb meta-set spec:/tests/spec/test check/validation "[1-9][0-9]*" -kdb meta-set spec:/tests/spec/test check/validation/match LINE -kdb meta-set spec:/tests/spec/test check/validation/message "Not a number" +kdb meta set spec:/tests/spec/test check/validation "[1-9][0-9]*" +kdb meta set spec:/tests/spec/test check/validation/match LINE +kdb meta set spec:/tests/spec/test check/validation/message "Not a number" ``` If we now set a new key with @@ -271,7 +271,7 @@ There are many ways to do so directly supported by [the spec plugin](/src/plugin Another way is to trigger errors with the [error plugin](/src/plugins/error): ```sh -kdb meta-set spec:/tests/tutorial/spec/should_not_be_here trigger/error C03200 +kdb meta set spec:/tests/tutorial/spec/should_not_be_here trigger/error C03200 kdb spec-mount /tests/tutorial kdb set user:/tests/tutorial/spec/should_not_be_here abc # RET: 5 @@ -316,7 +316,7 @@ sudo kdb mount range.ecf /tests/range range dump kdb set user:/tests/range/value 5 # add range check to all keys under /tests/range/ -kdb meta-set spec:/tests/range/_ check/range "1-10" +kdb meta set spec:/tests/range/_ check/range "1-10" # check if validate passes kdb validate /tests/range diff --git a/scripts/configure-firefox.in b/scripts/configure-firefox.in index e6cca5e3955..2a005dd9e65 100755 --- a/scripts/configure-firefox.in +++ b/scripts/configure-firefox.in @@ -131,9 +131,9 @@ setAutoPrefs() { echo "Error, Mountpoint $PrefsSetupMountPoint already in use" exit 1 fi - kdb meta-set "${PrefsSetupMountPoint}/user/elektra/config/file" type string &> /dev/null + kdb meta set "${PrefsSetupMountPoint}/user/elektra/config/file" type string &> /dev/null kdb set "${PrefsSetupMountPoint}/user/elektra/config/file" "$Decoy" &> /dev/null - kdb meta-set "${PrefsSetupMountPoint}/user/elektra/config/reload_trigger_port" type string &> /dev/null + kdb meta set "${PrefsSetupMountPoint}/user/elektra/config/reload_trigger_port" type string &> /dev/null kdb set "${PrefsSetupMountPoint}/user/elektra/config/reload_trigger_port" "$TriggerPort" &> /dev/null errCount=$(testAutoPrefs) kdb umount "$PrefsSetupMountPoint" &> /dev/null @@ -176,17 +176,17 @@ setPreload() { setTestPrefs() { kdb mount "$ConfigFile" "$MountPoint" mozprefs shell execute/set="echo -n \"reload\"|nc 127.0.0.1 $TriggerPort" - kdb meta-set "${MountPoint}/lock/a/lock/1" type string + kdb meta set "${MountPoint}/lock/a/lock/1" type string kdb set "${MountPoint}/lock/a/lock/1" "lock1" - kdb meta-set "${MountPoint}/lock/a/lock/2" type string + kdb meta set "${MountPoint}/lock/a/lock/2" type string kdb set "${MountPoint}/lock/a/lock/2" "lock2" - kdb meta-set "${MountPoint}/pref/a/default/1" type integer + kdb meta set "${MountPoint}/pref/a/default/1" type integer kdb set "${MountPoint}/pref/a/default/1" 1 - kdb meta-set "${MountPoint}/pref/a/default/2" type integer + kdb meta set "${MountPoint}/pref/a/default/2" type integer kdb set "${MountPoint}/pref/a/default/2" 2 - kdb meta-set "${MountPoint}/user/a/user/t" type boolean + kdb meta set "${MountPoint}/user/a/user/t" type boolean kdb set "${MountPoint}/user/a/user/t" true - kdb meta-set "${MountPoint}/user/a/user/f" type boolean + kdb meta set "${MountPoint}/user/a/user/f" type boolean kdb set "${MountPoint}/user/a/user/f" false } diff --git a/scripts/ffconfig/setupProxy b/scripts/ffconfig/setupProxy index 6e7ff834073..c10e55eac97 100755 --- a/scripts/ffconfig/setupProxy +++ b/scripts/ffconfig/setupProxy @@ -3,7 +3,7 @@ # guided setup for proxy preferences used by configure-firefox setProxyType() { - kdb meta-set "${MountPoint}/${prefType}/network/proxy/type" type integer + kdb meta set "${MountPoint}/${prefType}/network/proxy/type" type integer kdb set "${MountPoint}/${prefType}/network/proxy/type" "$1" } diff --git a/src/plugins/base64/README.md b/src/plugins/base64/README.md index 947bb03649a..5f4031c9774 100644 --- a/src/plugins/base64/README.md +++ b/src/plugins/base64/README.md @@ -119,7 +119,7 @@ kdb file user:/tests/base64/encoded | xargs cat | grep encoded #> encoded = dmFsdWUA # Tell Base64 plugin to decode and encode key value -kdb meta-set user:/tests/base64/encoded type binary +kdb meta set user:/tests/base64/encoded type binary # Receive key data (the `\x0` at the end marks the end of the string) kdb get user:/tests/base64/encoded diff --git a/src/plugins/blacklist/README.md b/src/plugins/blacklist/README.md index fa36c835bff..6fafa9332fd 100644 --- a/src/plugins/blacklist/README.md +++ b/src/plugins/blacklist/README.md @@ -42,10 +42,10 @@ sudo kdb mount blacklist.ecf /tests/blacklist blacklist # valid initial value + setup valid blacklist list kdb set user:/tests/blacklist "" kdb set user:/tests/blacklist/value water -kdb meta-set spec:/tests/blacklist/value check/blacklist '#2' -kdb meta-set spec:/tests/blacklist/value check/blacklist/#0 fire -kdb meta-set spec:/tests/blacklist/value check/blacklist/#1 air -kdb meta-set spec:/tests/blacklist/value check/blacklist/#2 cold/water +kdb meta set spec:/tests/blacklist/value check/blacklist '#2' +kdb meta set spec:/tests/blacklist/value check/blacklist/#0 fire +kdb meta set spec:/tests/blacklist/value check/blacklist/#1 air +kdb meta set spec:/tests/blacklist/value check/blacklist/#2 cold/water # should succeed kdb set user:/tests/blacklist/value earth @@ -70,8 +70,8 @@ It is also possible to blacklist empty values: ```sh kdb set user:/tests/blacklist/empty water -kdb meta-set spec:/tests/blacklist/empty check/blacklist '#0' -kdb meta-set spec:/tests/blacklist/empty check/blacklist/#0 '' +kdb meta set spec:/tests/blacklist/empty check/blacklist '#0' +kdb meta set spec:/tests/blacklist/empty check/blacklist/#0 '' # should succeed kdb set user:/tests/blacklist/empty earth @@ -82,7 +82,7 @@ kdb set user:/tests/blacklist/empty '' # ERROR:C03200 # Undo changes -kdb rm -r spec:/tests/blacklist +kdb rm -rf spec:/tests/blacklist kdb rm -r user:/tests/blacklist || kdb rm -r system:/tests/blacklist # sudo kdb umount spec:/tests/blacklist sudo kdb umount /tests/blacklist diff --git a/src/plugins/conditionals/README.md b/src/plugins/conditionals/README.md index 0576359e995..b77652d2a5b 100644 --- a/src/plugins/conditionals/README.md +++ b/src/plugins/conditionals/README.md @@ -82,10 +82,10 @@ kdb set user:/tests/conditionals/fkey 3.0 kdb set user:/tests/conditionals/hkey hello # will succeed -kdb meta-set user:/tests/conditionals/key check/condition "(../hkey == 'hello') ? (../fkey == '3.0')" +kdb meta set user:/tests/conditionals/key check/condition "(../hkey == 'hello') ? (../fkey == '3.0')" # will fail -kdb meta-set user:/tests/conditionals/key check/condition "(../hkey == 'hello') ? (../fkey == '5.0')" +kdb meta set user:/tests/conditionals/key check/condition "(../hkey == 'hello') ? (../fkey == '5.0')" # RET:5 # ERROR:C03200 ``` @@ -96,7 +96,7 @@ Assignment example: ``` kdb set user:/tests/conditionals/hkey Hello -kdb meta-set user:/tests/conditionals/hkey assign/condition "(./ == 'Hello') ? ('World')" +kdb meta set user:/tests/conditionals/hkey assign/condition "(./ == 'Hello') ? ('World')" # alternative syntax: "(../hkey == 'Hello') ? ('World') kdb get user:/tests/conditionals/hkey diff --git a/src/plugins/crypto/README.md b/src/plugins/crypto/README.md index bf751a9415b..7fdc3ef9bc4 100644 --- a/src/plugins/crypto/README.md +++ b/src/plugins/crypto/README.md @@ -79,7 +79,7 @@ Now you can specify a key `user:/t/a` and protect its content by using: ```sh kdb set user:/tests/t/a -kdb meta-set user:/tests/t/a crypto/encrypt 1 +kdb meta set user:/tests/t/a crypto/encrypt 1 kdb set user:/tests/t/a "secret" ``` diff --git a/src/plugins/directoryvalue/README.md b/src/plugins/directoryvalue/README.md index b3031b7ca9c..2d771d6583d 100644 --- a/src/plugins/directoryvalue/README.md +++ b/src/plugins/directoryvalue/README.md @@ -152,7 +152,7 @@ kdb set user:/tests/directoryvalue/patrick/#0 'Being grown-up is boring. Besides # Elektra requires that the array parent contains the metakey `array`. # If this key is not present, then `user:/tests/directoryvalue/patrick` # is **not an array**. -kdb meta-set user:/tests/directoryvalue/patrick array '' +kdb meta set user:/tests/directoryvalue/patrick array '' # Since the plugin converts values back in the get direction # a user of the database will not notice any changes. diff --git a/src/plugins/email/README.md b/src/plugins/email/README.md index 4c79c3bcd63..55e8813d85e 100644 --- a/src/plugins/email/README.md +++ b/src/plugins/email/README.md @@ -33,7 +33,7 @@ kdb set user:/tests/email/noaddr invalid..address@com # RET: 0 # Check the validity of the email stored in `/tests/email/adr` -kdb meta-set spec:/tests/email/adr check/email "" +kdb meta set spec:/tests/email/adr check/email "" # Set a correct email address kdb set user:/tests/email/adr test+email@dev.libelektra.com diff --git a/src/plugins/error/README.md b/src/plugins/error/README.md index 4df46a7d474..151200835b2 100644 --- a/src/plugins/error/README.md +++ b/src/plugins/error/README.md @@ -55,14 +55,14 @@ So an error and warnings can be injected directly with the kdb tool. E.g. the warning number C01330: ```sh -kdb meta-set system:/error/key trigger/warnings C01330 +kdb meta set system:/error/key trigger/warnings C01330 ``` or the error number C01200 (will not modify the KDB because `kdbSet()` will fail for the error plugin then): ```sh -kdb meta-set user:/error/key trigger/error C01200 +kdb meta set user:/error/key trigger/error C01200 # RET:5 ``` diff --git a/src/plugins/gpgme/README.md b/src/plugins/gpgme/README.md index bffe0a221c5..891d12499d2 100644 --- a/src/plugins/gpgme/README.md +++ b/src/plugins/gpgme/README.md @@ -42,7 +42,7 @@ Now you can specify a key `user:/t/a` and protect its content by using: ```sh kdb set user:/t/a -kdb meta-set user:/t/a crypt/encrypt 1 +kdb meta set user:/t/a crypt/encrypt 1 kdb set user:/t/a "secret" ``` diff --git a/src/plugins/hexnumber/README.md b/src/plugins/hexnumber/README.md index 0de6498331e..8a53d5e9c15 100644 --- a/src/plugins/hexnumber/README.md +++ b/src/plugins/hexnumber/README.md @@ -67,28 +67,28 @@ When mounting a backend with the hexnumber plugin, a few settings can be configu ```sh # Example 1: read hex value kdb set user:/tests/hexnumber/hex 0x1F - kdb meta-set user:/tests/hexnumber/hex type long + kdb meta set user:/tests/hexnumber/hex type long kdb get user:/tests/hexnumber/hex #> 31 # Example 2: decimal value not converted kdb set user:/tests/hexnumber/dec 26 - kdb meta-set user:/tests/hexnumber/dec type long + kdb meta set user:/tests/hexnumber/dec type long kdb get user:/tests/hexnumber/dec #> 26 # Example 3: string untouched kdb set user:/tests/hexnumber/string value - kdb meta-set user:/tests/hexnumber/string type string + kdb meta set user:/tests/hexnumber/string type string kdb get user:/tests/hexnumber/string #> value # Example 4: read hex value with unit/base kdb set user:/tests/hexnumber/hex2 0xF - kdb meta-set user:/tests/hexnumber/hex2 unit/base hex + kdb meta set user:/tests/hexnumber/hex2 unit/base hex kdb get user:/tests/hexnumber/hex2 #> 15 diff --git a/src/plugins/ipaddr/README.md b/src/plugins/ipaddr/README.md index 0fac98a2d59..7bb0802be16 100644 --- a/src/plugins/ipaddr/README.md +++ b/src/plugins/ipaddr/README.md @@ -27,7 +27,7 @@ The package is called `libelektra5-experimental`. kdb mount config.dump /tests/ipaddr dump ipaddr # Check the validity of the IP stored in `system:/tests/ipaddr/ipv4` -kdb meta-set spec:/tests/ipaddr/ipv4 check/ipaddr ipv4 +kdb meta set spec:/tests/ipaddr/ipv4 check/ipaddr ipv4 # Try to set an incorrect IP address kdb set system:/tests/ipaddr/ipv4 127.0.0.1337 @@ -41,7 +41,7 @@ kdb get system:/tests/ipaddr/ipv4 #> 127.0.0.1 # By default the plugin allows both IPv4 and IPv6 addresses -kdb meta-set spec:/tests/ipaddr/address check/ipaddr "" +kdb meta set spec:/tests/ipaddr/address check/ipaddr "" # Set correct IP addresses kdb set system:/tests/ipaddr/address 1.2.3.4 diff --git a/src/plugins/length/README.md b/src/plugins/length/README.md index 32edd6efc82..e15e6b1decb 100644 --- a/src/plugins/length/README.md +++ b/src/plugins/length/README.md @@ -28,7 +28,7 @@ The package is called `libelektra5-experimental`. kdb mount config.dump /tests/length length # Check the validity of the string stored in `/tests/length/text` -kdb meta-set spec:/tests/length/text check/length/max 3 +kdb meta set spec:/tests/length/text check/length/max 3 # Try to set a longer string kdb set user:/tests/length/text abcd diff --git a/src/plugins/macaddr/README.md b/src/plugins/macaddr/README.md index 38244aa51d9..20da6f5d297 100644 --- a/src/plugins/macaddr/README.md +++ b/src/plugins/macaddr/README.md @@ -50,10 +50,10 @@ kdb set user:/tests/mac/mac4 17661175009296 # RET: 0 # Marking written keys as MAC addresses -kdb meta-set user:/tests/mac/mac1 check/macaddr "" -kdb meta-set user:/tests/mac/mac2 check/macaddr "" -kdb meta-set user:/tests/mac/mac3 check/macaddr "" -kdb meta-set user:/tests/mac/mac4 check/macaddr "" +kdb meta set user:/tests/mac/mac1 check/macaddr "" +kdb meta set user:/tests/mac/mac2 check/macaddr "" +kdb meta set user:/tests/mac/mac3 check/macaddr "" +kdb meta set user:/tests/mac/mac4 check/macaddr "" # Setting a MAC address using an invalid address kdb set user:/tests/mac/mac1 00:G1:C9:14:C8:29 diff --git a/src/plugins/mathcheck/README.md b/src/plugins/mathcheck/README.md index a930f05902a..c091f8ecad5 100644 --- a/src/plugins/mathcheck/README.md +++ b/src/plugins/mathcheck/README.md @@ -40,7 +40,7 @@ sudo kdb mount mathcheck.dump user:/tests/mathcheck mathcheck kdb set user:/tests/mathcheck/a 3.1 kdb set user:/tests/mathcheck/b 4.5 kdb set user:/tests/mathcheck/k 7.6 -kdb meta-set user:/tests/mathcheck/k check/math "== + ../a ../b" +kdb meta set user:/tests/mathcheck/k check/math "== + ../a ../b" # should fail kdb set user:/tests/mathcheck/k 7.7 @@ -54,7 +54,7 @@ kdb set user:/tests/mathcheck/k 7.7 To calculate values on-demand you can use: ```sh -kdb meta-set user:/tests/mathcheck/k check/math ":= + @/a @/b" +kdb meta set user:/tests/mathcheck/k check/math ":= + @/a @/b" kdb set user:/tests/mathcheck/a 8.0 kdb set user:/tests/mathcheck/b 4.5 @@ -70,7 +70,7 @@ kdb get user:/tests/mathcheck/k It also works with constants: ```sh -kdb meta-set user:/tests/mathcheck/k check/math ":= + ../a '5'" +kdb meta set user:/tests/mathcheck/k check/math ":= + ../a '5'" kdb set user:/tests/mathcheck/a 5.5 kdb get user:/tests/mathcheck/k diff --git a/src/plugins/mini/README.md b/src/plugins/mini/README.md index ba911d834ad..69c111c6dbc 100644 --- a/src/plugins/mini/README.md +++ b/src/plugins/mini/README.md @@ -121,7 +121,7 @@ cat stderr.txt | grep -oE 'Line [[:digit:]]+.*' | sed 's/^[[:space:]]*//' #> Line 3: 'line"' is not a valid key value pair # Unlike the `ini` and `ni` plugin, mINI does not support metadata. -kdb meta-set user:/tests/mini foo bar +kdb meta set user:/tests/mini foo bar # RET: 5 kdb meta-ls user:/tests/mini diff --git a/src/plugins/mmapstorage/README.md b/src/plugins/mmapstorage/README.md index 290df503863..c1b72a1415b 100644 --- a/src/plugins/mmapstorage/README.md +++ b/src/plugins/mmapstorage/README.md @@ -65,7 +65,7 @@ sudo kdb mount config.mmap user:/tests/mmapstorage mmapstorage kdb set user:/tests/mmapstorage 'Some root key' kdb set user:/tests/mmapstorage/dir 'Directory within the hierarchy.' kdb set user:/tests/mmapstorage/dir/leaf 'A leaf node holding some valuable data.' -kdb meta-set user:/tests/mmapstorage/dir/leaf superMetaKey 'Metadata is supported too.' +kdb meta set user:/tests/mmapstorage/dir/leaf superMetaKey 'Metadata is supported too.' # List the configuration tree below `user:/tests/mmapstorage` kdb ls user:/tests/mmapstorage diff --git a/src/plugins/mozprefs/README.md b/src/plugins/mozprefs/README.md index 92b6454a9a6..91282ff46e2 100644 --- a/src/plugins/mozprefs/README.md +++ b/src/plugins/mozprefs/README.md @@ -53,11 +53,11 @@ will all result in `lockPref("a.lock.key", "lock");` sudo kdb mount prefs.js user:/tests/mozprefs mozprefs -kdb meta-set user:/tests/mozprefs/lock/a/lock/key type boolean +kdb meta set user:/tests/mozprefs/lock/a/lock/key type boolean kdb set user:/tests/mozprefs/lock/a/lock/key true -kdb meta-set user:/tests/mozprefs/pref/a/default/key type string +kdb meta set user:/tests/mozprefs/pref/a/default/key type string kdb set user:/tests/mozprefs/pref/a/default/key "i'm a default key" -kdb meta-set user:/tests/mozprefs/user/a/user/key type integer +kdb meta set user:/tests/mozprefs/user/a/user/key type integer kdb set user:/tests/mozprefs/user/a/user/key 123 cat `kdb file user:/tests/mozprefs` diff --git a/src/plugins/mozprefs/autoconfig/README.md b/src/plugins/mozprefs/autoconfig/README.md index 6204827547d..b2f6acc23b0 100644 --- a/src/plugins/mozprefs/autoconfig/README.md +++ b/src/plugins/mozprefs/autoconfig/README.md @@ -72,11 +72,11 @@ Setting lockPref HTTP Proxy to 127.0.0.1:8080 This example shows how to manually setup a preferences. It's equivalent to the example shown above in the `Guided setup` ```sh -kdb meta-set user:/prefs/lock/network/proxy/type type integer +kdb meta set user:/prefs/lock/network/proxy/type type integer kdb set user:/prefs/lock/network/proxy/type 1 -kdb meta-set user:/prefs/lock/network/proxy/http type string +kdb meta set user:/prefs/lock/network/proxy/http type string kdb set user:/prefs/lock/network/proxy/http 127.0.0.1 -kdb meta-set user:/prefs/lock/network/proxy/http_port type integer +kdb meta set user:/prefs/lock/network/proxy/http_port type integer kdb set user:/prefs/lock/network/proxy/http_port 8080 ``` @@ -118,7 +118,7 @@ kdb elektrify-open firefox-esr "about:config" ![about:config before](./config_1.jpg) ```sh -kdb meta-set user:/prefs/lock/a/lock/3 type boolean +kdb meta set user:/prefs/lock/a/lock/3 type boolean kdb set user:/prefs/lock/a/lock/3 true kdb export user:/prefs #> [lock/a/lock] diff --git a/src/plugins/network/README.md b/src/plugins/network/README.md index eec8d03233b..b5624165585 100644 --- a/src/plugins/network/README.md +++ b/src/plugins/network/README.md @@ -51,7 +51,7 @@ sudo kdb mount config.file user:/tests/network network # Set valid IPv4 address kdb set user:/tests/network/host 127.0.0.1 # Check for valid IPv4 address -kdb meta-set user:/tests/network/host check/ipaddr ipv4 +kdb meta set user:/tests/network/host check/ipaddr ipv4 # Try to set invalid IPv4 address kdb set user:/tests/network/host 133.133.133.1337 @@ -67,7 +67,7 @@ kdb get user:/tests/network/host #> 1.2.3.4 # Check for any valid network address -kdb meta-set user:/tests/network/host check/ipaddr '' +kdb meta set user:/tests/network/host check/ipaddr '' # If identifier `localhost` is not a valid network address it is not part of /etc/hosts kdb set user:/tests/network/host localhost || ! grep -q localhost /etc/hosts diff --git a/src/plugins/ni/README.md b/src/plugins/ni/README.md index 60e1e25a70a..a92b28f3c10 100644 --- a/src/plugins/ni/README.md +++ b/src/plugins/ni/README.md @@ -68,8 +68,13 @@ For in-detail explanation of the syntax sudo kdb mount file.ini spec:/tests/ni ni # Add some metadata -kdb meta-set spec:/tests/ni/key metakey metavalue -kdb meta-set spec:/tests/ni/key check/type char +kdb meta set spec:/tests/ni/key metakey metavalue +kdb meta get spec:/tests/ni/key metakey +#> metavalue + +kdb meta set spec:/tests/ni/key check/type char +kdb meta get spec:/tests/ni/key check/type +#> char # Retrieve metadata kdb meta-ls spec:/tests/ni/key diff --git a/src/plugins/path/README.md b/src/plugins/path/README.md index 1641f8d0bba..3fc78b5945c 100644 --- a/src/plugins/path/README.md +++ b/src/plugins/path/README.md @@ -63,9 +63,9 @@ An example on which the user should have no permission at all for the root direc ```sh sudo kdb mount test.dump user:/tests path dump sudo kdb set user:/tests/path "$HOME" -sudo kdb meta-set user:/tests/path check/path "" -sudo kdb meta-set user:/tests/path check/path/user "" -sudo kdb meta-set user:/tests/path check/path/mode "rw" +sudo kdb meta set user:/tests/path check/path "" +sudo kdb meta set user:/tests/path check/path/user "" +sudo kdb meta set user:/tests/path check/path/mode "rw" # Standard users should not be able to read/write the root folder [ $(id -u) = 0 ] && printf >&2 'User is root\n' || kdb set user:/tests/path "/root" @@ -85,9 +85,9 @@ An example where part of the permissions are missing for a tmp file ```sh sudo kdb mount test.dump user:/tests path dump sudo kdb set user:/tests/path "$HOME" -sudo kdb meta-set user:/tests/path check/path "" -sudo kdb meta-set user:/tests/path check/path/user "" -sudo kdb meta-set user:/tests/path check/path/mode "rwx" +sudo kdb meta set user:/tests/path check/path "" +sudo kdb meta set user:/tests/path check/path/user "" +sudo kdb meta set user:/tests/path check/path/mode "rwx" # Standard users should not be able to read/write the root folder kdb set user:/tests/path/tempfile $(mktemp) diff --git a/src/plugins/process/README.md b/src/plugins/process/README.md index e41a82ab0c1..a6920d6ff4b 100644 --- a/src/plugins/process/README.md +++ b/src/plugins/process/README.md @@ -180,9 +180,9 @@ If an unexpected error occurs on either side of the protocol, the connection sho sudo kdb mount config.file user:/tests/process dump process 'executable=/usr/bin/java' 'args=#3' 'args/#0=-cp' "args/#1=$BUILD_DIR/src/bindings/jna/plugins/whitelist/build/libs/whitelist-$(kdb --version | sed -nE 's/KDB_VERSION: (.+)/\1/gp')-all.jar" 'args/#2=org.libelektra.process.PluginProcess' 'args/#3=org.libelektra.plugin.WhitelistPlugin' 'copyenv=#0' "copyenv/#0=LD_LIBRARY_PATH" # Define whitelist -kdb meta-set user:/tests/process/key "check/whitelist/#0" "" -kdb meta-set user:/tests/process/key "check/whitelist/#1" allowed0 -kdb meta-set user:/tests/process/key "check/whitelist/#2" allowed1 +kdb meta set user:/tests/process/key "check/whitelist/#0" "" +kdb meta set user:/tests/process/key "check/whitelist/#1" allowed0 +kdb meta set user:/tests/process/key "check/whitelist/#2" allowed1 # Should be allowed kdb set user:/tests/process/key allowed0 diff --git a/src/plugins/python/python/dns/README.md b/src/plugins/python/python/dns/README.md index 3077c35c527..04c4ed202f7 100644 --- a/src/plugins/python/python/dns/README.md +++ b/src/plugins/python/python/dns/README.md @@ -23,7 +23,7 @@ sudo kdb mount file.ini /python ni python script=/path/to/dns_plugin.py For the plugin to actually check a certain key, the `check/dns` metakey must be set. ```sh -sudo kdb meta-set spec:/python/my_hostname check/dns '' +sudo kdb meta set spec:/python/my_hostname check/dns '' ``` Now each time the key is set, the filter plugin validates the given value. diff --git a/src/plugins/python/python/dns/src/main/dns_plugin.py b/src/plugins/python/python/dns/src/main/dns_plugin.py index 3edeeb5ac26..451264143ee 100644 --- a/src/plugins/python/python/dns/src/main/dns_plugin.py +++ b/src/plugins/python/python/dns/src/main/dns_plugin.py @@ -4,7 +4,7 @@ """ Usage: > sudo kdb mount file.ini /python python script=/path/to/dns_plugin.py -> kdb meta-set user:/python/my_hostname check/dns '' +> kdb meta set user:/python/my_hostname check/dns '' > kdb set user:/python/my_hostname www.libelektra.org """ diff --git a/src/plugins/quickdump/README.md b/src/plugins/quickdump/README.md index 015403808fc..d7eba27a66e 100644 --- a/src/plugins/quickdump/README.md +++ b/src/plugins/quickdump/README.md @@ -83,7 +83,7 @@ sudo kdb mount quickdump.eqd user:/tests/quickdump quickdump kdb set user:/tests/quickdump/key value #> Create a new key user:/tests/quickdump/key with string "value" -kdb meta-set user:/tests/quickdump/key meta "metavalue" +kdb meta set user:/tests/quickdump/key meta "metavalue" kdb set user:/tests/quickdump/otherkey "other value" #> Create a new key user:/tests/quickdump/otherkey with string "other value" diff --git a/src/plugins/range/README.md b/src/plugins/range/README.md index ca77dbe6c8c..198b2af0e62 100644 --- a/src/plugins/range/README.md +++ b/src/plugins/range/README.md @@ -62,7 +62,7 @@ sudo kdb mount range.ecf /tests/range range dump # should succeed kdb set user:/tests/range/value 5 -kdb meta-set spec:/tests/range/value check/range "1-10" +kdb meta set spec:/tests/range/value check/range "1-10" # RET: 0 # should fail @@ -74,7 +74,7 @@ kdb set user:/tests/range/value "\-1" # RET:5 # we can also allow only individual values: (using the --force flag, as the current value of 5 would not be allowed under the new policy) -kdb meta-set -f spec:/tests/range/value check/range "1,2,4,8" +kdb meta set spec:/tests/range/value check/range "1,2,4,8" kdb set user:/tests/range/value 7 # RET:5 diff --git a/src/plugins/reference/README.md b/src/plugins/reference/README.md index 3632aff89e8..5aeaa551b3d 100644 --- a/src/plugins/reference/README.md +++ b/src/plugins/reference/README.md @@ -111,7 +111,7 @@ and therefore cannot have a value (other than the empty string `""`). sudo kdb mount referencetest.dump user:/tests/reference dump reference # Mark a key as a single reference -kdb meta-set user:/tests/reference/singleref check/reference single +kdb meta set user:/tests/reference/singleref check/reference single # Try setting an invalid reference kdb set user:/tests/reference/singleref user:/tests/reference/referred1 diff --git a/src/plugins/rgbcolor/README.md b/src/plugins/rgbcolor/README.md index 14ffe364f0d..50633d5346e 100644 --- a/src/plugins/rgbcolor/README.md +++ b/src/plugins/rgbcolor/README.md @@ -33,7 +33,7 @@ sudo kdb mount color.ecf user:/tests/color dump rgbcolor kdb set user:/tests/color/hex "#a1C2b3" # Tell the plugin to validate the key and normalize if necessary -kdb meta-set user:/tests/color/hex check/rgbcolor "" +kdb meta set user:/tests/color/hex check/rgbcolor "" # Colors are normalized to 32-bit unsigned integers # This one is normalized to 0xa1C2b3ff @@ -48,7 +48,7 @@ kdb get user:/tests/color/hex #> 2597139199 kdb set user:/tests/color/hex/subcolor "#abc" -kdb meta-set user:/tests/color/hex/subcolor check/rgbcolor "" +kdb meta set user:/tests/color/hex/subcolor check/rgbcolor "" # Expanded to rgba: #aabbccff kdb get user:/tests/color/hex/subcolor diff --git a/src/plugins/spec/README.md b/src/plugins/spec/README.md index eb137304fcc..dbce738b286 100644 --- a/src/plugins/spec/README.md +++ b/src/plugins/spec/README.md @@ -157,19 +157,19 @@ A specification could look like this (`yaml`): Below is an explanation of each command. -### kdb meta-set spec:/tests/sw/org/webserver/name require true +### kdb meta set spec:/tests/sw/org/webserver/name require true Adding a specification key with a require metakey. -This `meta-set` command should throw error as no key with the name `/tests/sw/org/webserver/name` exists. +This `meta set` command should throw error as no key with the name `/tests/sw/org/webserver/name` exists. ### kdb set user:/tests/sw/org/webserver/name web1 Set the value for `user:/tests/sw/org/webserver/name` to `web1`. -### kdb meta-set spec:/tests/sw/org/webserver/port default 5000 +### kdb meta set spec:/tests/sw/org/webserver/port default 5000 Adding a specification key with a default metakey. -After this `meta-set` command a `default:/tests/sw/org/webserver/port` with value `5000` should exist. +After this `meta set` command a `default:/tests/sw/org/webserver/port` with value `5000` should exist. ### kdb set user:/tests/sw/org/webserver/alternative_ports/#0 5001 @@ -179,14 +179,14 @@ Adding an array key `user:/tests/sw/org/webserver/alternative_ports/#0` which va Adding an array key `user:/tests/sw/org/webserver/alternative_ports/#1` which value is set to `5002`. -### kdb meta-set user:/tests/sw/org/webserver/alternative_ports array '2' +### kdb meta set user:/tests/sw/org/webserver/alternative_ports array '2' Adding a metakey `array` with value `2` at `user:/tests/sw/org/webserver/alternative_ports`. -### kdb meta-set spec:/tests/sw/org/webserver/alternative_ports/# description 'This is an alternative port if any other is already bound' +### kdb meta set spec:/tests/sw/org/webserver/alternative_ports/# description 'This is an alternative port if any other is already bound' Adding a specification metakey `description`. -After this `meta-set` the all the array entries (`#0` and `#1`) should contain the `description`. +After this `meta set` the all the array entries (`#0` and `#1`) should contain the `description`. ### kdb meta get user:/tests/sw/org/webserver/alternative_ports/#0 description @@ -197,13 +197,13 @@ Check if the `description` metakey was copied successfully. Check if the `description` metakey was copied successfully. ```sh -kdb meta-set spec:/tests/sw/org/webserver/name require true +kdb meta set spec:/tests/sw/org/webserver/name require true # RET: 5 kdb set user:/tests/sw/org/webserver/name web1 # RET: 0 -kdb meta-set spec:/tests/sw/org/webserver/port default 5000 +kdb meta set spec:/tests/sw/org/webserver/port default 5000 # RET: 0 kdb set user:/tests/sw/org/webserver/alternative_ports/#0 5001 @@ -212,10 +212,10 @@ kdb set user:/tests/sw/org/webserver/alternative_ports/#0 5001 kdb set user:/tests/sw/org/webserver/alternative_ports/#1 5002 #> Create a new key user:/tests/sw/org/webserver/alternative_ports/#1 with string "5002" -kdb meta-set user:/tests/sw/org/webserver/alternative_ports array '2' +kdb meta set user:/tests/sw/org/webserver/alternative_ports array '2' # RET: 0 -kdb meta-set spec:/tests/sw/org/webserver/alternative_ports/# description 'This is an alternative port if any other is already bound' +kdb meta set spec:/tests/sw/org/webserver/alternative_ports/# description 'This is an alternative port if any other is already bound' # RET: 0 kdb meta get user:/tests/sw/org/webserver/alternative_ports/#0 description diff --git a/src/plugins/specload/README.md b/src/plugins/specload/README.md index abe55134f3b..978233686f8 100644 --- a/src/plugins/specload/README.md +++ b/src/plugins/specload/README.md @@ -75,7 +75,7 @@ ksDel (specloadConf); The code above will automatically print the KeySet `ks` to stdout in exactly the way `specload` expects it. Once the mounting is done you can inspect you specification like you would with any other mounted configuration. If you call `kdb set` -(or `kdb meta-set` or anything else that calls `kdbSet()`), however, `specload` will verify that the modifications you made are compatible +(or `kdb meta set` or anything else that calls `kdbSet()`), however, `specload` will verify that the modifications you made are compatible with the original specification. Currently this verification is very restrictive and doesn't allow a lot of changes that would be safe. This is because the necessary verification becomes very complex very quickly. For example adding `opt/arg` is only safe, if `opt` was also added by the user, because the application might rely on the default `opt/arg=none`. See also [Limitations](#limitations). diff --git a/src/plugins/toml/README.md b/src/plugins/toml/README.md index 0c162735440..a9d8743a211 100644 --- a/src/plugins/toml/README.md +++ b/src/plugins/toml/README.md @@ -107,14 +107,14 @@ cat `kdb file user:/tests/storage/types` # > value = 1 # Manually set the `type` metakey to boolean -kdb meta-set 'user:/tests/storage/types/value' 'type' 'boolean' +kdb meta set 'user:/tests/storage/types/value' 'type' 'boolean' # The value is written as a boolean cat `kdb file user:/tests/storage/types` # > value = true # Manually set the `type` metakey to string -kdb meta-set 'user:/tests/storage/types/value' 'type' 'string' +kdb meta set 'user:/tests/storage/types/value' 'type' 'string' # The value is written as a string cat `kdb file user:/tests/storage/types` @@ -155,14 +155,14 @@ kdb meta get 'user:/tests/storage/numbers/a' 'type' # > unsigned_long_long # Change the value by changing the `origvalue` metakey -kdb meta-set 'user:/tests/storage/numbers/a' 'origvalue' '0o666' +kdb meta set 'user:/tests/storage/numbers/a' 'origvalue' '0o666' # Get the new value as decimal kdb get 'user:/tests/storage/numbers/a' # > 438 # Change the value to an invalid octal value. -kdb meta-set 'user:/tests/storage/numbers/a' 'origvalue' '0o888' +kdb meta set 'user:/tests/storage/numbers/a' 'origvalue' '0o888' # The key value is no longer considered a number kdb meta get 'user:/tests/storage/numbers/a' 'type' @@ -282,7 +282,7 @@ cat `kdb file user:/tests/storage` #> common.c = 2 # Create a simple table key -kdb meta-set 'user:/tests/storage/common' 'tomltype' 'simpletable' +kdb meta set 'user:/tests/storage/common' 'tomltype' 'simpletable' # Print the content of the resulting TOML file cat `kdb file user:/tests/storage` @@ -305,7 +305,7 @@ Table arrays are represented by setting the `tomltype` metakey to `tablearray`. sudo kdb mount test_table_array.toml user:/tests/storage toml type # Create a table array containing two entries, each with a key 'a' and 'b' -kdb meta-set 'user:/tests/storage/tablearray' 'tomltype' 'tablearray' +kdb meta set 'user:/tests/storage/tablearray' 'tomltype' 'tablearray' kdb set 'user:/tests/storage/tablearray/#0/a' '1' kdb set 'user:/tests/storage/tablearray/#0/b' '2' @@ -339,10 +339,10 @@ Inline tables are represented by setting the `tomltype` metakey to `inlinetable` sudo kdb mount test_inline_table.toml user:/tests/storage toml type # Create a table array containing two entries, each with a key 'a' and 'b' -kdb meta-set 'user:/tests/storage/inlinetable' 'tomltype' 'inlinetable' +kdb meta set 'user:/tests/storage/inlinetable' 'tomltype' 'inlinetable' kdb set 'user:/tests/storage/inlinetable/a' '1' kdb set 'user:/tests/storage/inlinetable/b' '2' -kdb meta-set 'user:/tests/storage/inlinetable/nested' 'tomltype' 'inlinetable' +kdb meta set 'user:/tests/storage/inlinetable/nested' 'tomltype' 'inlinetable' kdb set 'user:/tests/storage/inlinetable/nested/x' '3' kdb set 'user:/tests/storage/inlinetable/nested/y' '4' @@ -408,18 +408,18 @@ sudo kdb mount test_comments.toml user:/tests/storage toml type kdb set 'user:/tests/storage/key' '1' # add an inline comment with 4 leading spaces -kdb meta-set 'user:/tests/storage/key' 'comment/#0' ' This value is very interesting' -kdb meta-set 'user:/tests/storage/key' 'comment/#0/space' ' ' +kdb meta set 'user:/tests/storage/key' 'comment/#0' ' This value is very interesting' +kdb meta set 'user:/tests/storage/key' 'comment/#0/space' ' ' # add some comments preceding the key -kdb meta-set 'user:/tests/storage/key' 'comment/#1' ' I am the top-most comment relative to my key.' -kdb meta-set 'user:/tests/storage/key' 'comment/#2' ' I am in the middle. Just boring.' -kdb meta-set 'user:/tests/storage/key' 'comment/#3' ' I am in the line right above my key.' +kdb meta set 'user:/tests/storage/key' 'comment/#1' ' I am the top-most comment relative to my key.' +kdb meta set 'user:/tests/storage/key' 'comment/#2' ' I am in the middle. Just boring.' +kdb meta set 'user:/tests/storage/key' 'comment/#3' ' I am in the line right above my key.' # add file ending comments and empty lines -kdb meta-set 'user:/tests/storage' 'comment/#1' ' First file-ending comment' -kdb meta-set 'user:/tests/storage' 'comment/#2/start' '' -kdb meta-set 'user:/tests/storage' 'comment/#3' ' Second file-ending comment. I am the last line of the file.' +kdb meta set 'user:/tests/storage' 'comment/#1' ' First file-ending comment' +kdb meta set 'user:/tests/storage' 'comment/#2/start' '' +kdb meta set 'user:/tests/storage' 'comment/#3' ' Second file-ending comment. I am the last line of the file.' # Print the content of the resulting TOML file cat `kdb file user:/tests/storage` @@ -453,29 +453,29 @@ kdb set 'user:/tests/storage/array/#1' '2' kdb set 'user:/tests/storage/array/#2' '3' # Add inline comment after the array -kdb meta-set 'user:/tests/storage/array' 'comment/#0' ' Inline comment after the array' -kdb meta-set 'user:/tests/storage/array' 'comment/#0/start' '#' -kdb meta-set 'user:/tests/storage/array' 'comment/#0/space' ' ' +kdb meta set 'user:/tests/storage/array' 'comment/#0' ' Inline comment after the array' +kdb meta set 'user:/tests/storage/array' 'comment/#0/start' '#' +kdb meta set 'user:/tests/storage/array' 'comment/#0/space' ' ' # Add comments for array elements -kdb meta-set 'user:/tests/storage/array/#0' 'comment/#0' ' Inline comment of first element' -kdb meta-set 'user:/tests/storage/array/#0' 'comment/#0/start' '#' -kdb meta-set 'user:/tests/storage/array/#0' 'comment/#0/space' ' ' +kdb meta set 'user:/tests/storage/array/#0' 'comment/#0' ' Inline comment of first element' +kdb meta set 'user:/tests/storage/array/#0' 'comment/#0/start' '#' +kdb meta set 'user:/tests/storage/array/#0' 'comment/#0/space' ' ' -kdb meta-set 'user:/tests/storage/array/#0' 'comment/#1' ' Comment preceding the first element' -kdb meta-set 'user:/tests/storage/array/#0' 'comment/#1/space' ' ' +kdb meta set 'user:/tests/storage/array/#0' 'comment/#1' ' Comment preceding the first element' +kdb meta set 'user:/tests/storage/array/#0' 'comment/#1/space' ' ' -kdb meta-set 'user:/tests/storage/array/#0' 'comment/#2' ' Another comment preceding the first element' -kdb meta-set 'user:/tests/storage/array/#0' 'comment/#2/space' ' ' +kdb meta set 'user:/tests/storage/array/#0' 'comment/#2' ' Another comment preceding the first element' +kdb meta set 'user:/tests/storage/array/#0' 'comment/#2/space' ' ' -kdb meta-set 'user:/tests/storage/array/#1' 'comment/#0' ' Inline comment of second element' -kdb meta-set 'user:/tests/storage/array/#1' 'comment/#0/space' ' ' +kdb meta set 'user:/tests/storage/array/#1' 'comment/#0' ' Inline comment of second element' +kdb meta set 'user:/tests/storage/array/#1' 'comment/#0/space' ' ' -kdb meta-set 'user:/tests/storage/array/#1' 'comment/#1' ' Comment preceding the second element' -kdb meta-set 'user:/tests/storage/array/#1' 'comment/#1/space' ' ' +kdb meta set 'user:/tests/storage/array/#1' 'comment/#1' ' Comment preceding the second element' +kdb meta set 'user:/tests/storage/array/#1' 'comment/#1/space' ' ' -kdb meta-set 'user:/tests/storage/array/#2' 'comment/#0' ' Inline comment of the last element' -kdb meta-set 'user:/tests/storage/array/#2' 'comment/#0/space' ' ' +kdb meta set 'user:/tests/storage/array/#2' 'comment/#0' ' Inline comment of the last element' +kdb meta set 'user:/tests/storage/array/#2' 'comment/#0/space' ' ' # Print the content of the resulting TOML file cat `kdb file user:/tests/storage` @@ -524,7 +524,7 @@ cat `kdb file user:/tests/storage` #> d = 3 # Create a simple table for the three keys under `common` -kdb meta-set 'user:/tests/storage/common' 'tomltype' 'simpletable' +kdb meta set 'user:/tests/storage/common' 'tomltype' 'simpletable' # Print the content of the resulting TOML file cat `kdb file user:/tests/storage` diff --git a/src/plugins/type/README.md b/src/plugins/type/README.md index 6f91009907a..8face92a3e7 100644 --- a/src/plugins/type/README.md +++ b/src/plugins/type/README.md @@ -186,7 +186,7 @@ sudo kdb mount typetest.dump user:/tests/type dump type kdb set user:/tests/type/key a #Only allow character values -kdb meta-set user:/tests/type/key type char +kdb meta set user:/tests/type/key type char kdb get user:/tests/type/key #> a @@ -216,11 +216,11 @@ sudo kdb mount typeenum.ecf user:/tests/type dump type # valid initial value + setup valid enum list kdb set user:/tests/type/value middle -kdb meta-set user:/tests/type/value check/enum '#2' -kdb meta-set user:/tests/type/value 'check/enum/#0' 'low' -kdb meta-set user:/tests/type/value 'check/enum/#1' 'middle' -kdb meta-set user:/tests/type/value 'check/enum/#2' 'high' -kdb meta-set user:/tests/type/value type enum +kdb meta set user:/tests/type/value check/enum '#2' +kdb meta set user:/tests/type/value 'check/enum/#0' 'low' +kdb meta set user:/tests/type/value 'check/enum/#1' 'middle' +kdb meta set user:/tests/type/value 'check/enum/#2' 'high' +kdb meta set user:/tests/type/value type enum # should succeed kdb set user:/tests/type/value low @@ -236,13 +236,13 @@ Or with multi-enums: ```sh # valid initial value + setup array with valid enums kdb set user:/tests/type/multivalue middle_small -kdb meta-set user:/tests/type/multivalue check/enum/#0 small -kdb meta-set user:/tests/type/multivalue check/enum/#1 middle -kdb meta-set user:/tests/type/multivalue check/enum/#2 large -kdb meta-set user:/tests/type/multivalue check/enum/#3 huge -kdb meta-set user:/tests/type/multivalue check/enum/delimiter _ -kdb meta-set user:/tests/type/multivalue check/enum "#3" -kdb meta-set user:/tests/type/multivalue type enum +kdb meta set user:/tests/type/multivalue check/enum/#0 small +kdb meta set user:/tests/type/multivalue check/enum/#1 middle +kdb meta set user:/tests/type/multivalue check/enum/#2 large +kdb meta set user:/tests/type/multivalue check/enum/#3 huge +kdb meta set user:/tests/type/multivalue check/enum/delimiter _ +kdb meta set user:/tests/type/multivalue check/enum "#3" +kdb meta set user:/tests/type/multivalue type enum # should succeed kdb set user:/tests/type/multivalue small_middle @@ -265,7 +265,7 @@ sudo kdb mount config.ecf user:/tests/type dump type # By default the plugin uses `1` (true) and `0` (false) to represent boolean values kdb set user:/tests/type/truthiness false -kdb meta-set user:/tests/type/truthiness type boolean +kdb meta set user:/tests/type/truthiness type boolean kdb get user:/tests/type/truthiness #> 0 @@ -282,7 +282,7 @@ sudo kdb umount user:/tests/type ```sh sudo kdb mount config.ecf user:/tests/type dump type kdb set user:/tests/type/truthiness 0 -kdb meta-set user:/tests/type/truthiness type boolean +kdb meta set user:/tests/type/truthiness type boolean kdb set user:/tests/type/truthiness yes # RET: 0 # Undo changes diff --git a/src/plugins/xerces/README.md b/src/plugins/xerces/README.md index 006dc39f7c4..166ef4f2ff0 100644 --- a/src/plugins/xerces/README.md +++ b/src/plugins/xerces/README.md @@ -104,9 +104,9 @@ XSD transformations, schemas or DTDs are not supported yet. sudo kdb mount xerces.xml user:/tests/xercesfile xerces kdb set user:/tests/xercesfile foo -kdb meta-set user:/tests/xercesfile xerces/rootname xerces +kdb meta set user:/tests/xercesfile xerces/rootname xerces kdb set user:/tests/xercesfile/bar bar -kdb meta-set user:/tests/xercesfile/bar meta "da_ta" +kdb meta set user:/tests/xercesfile/bar meta "da_ta" kdb meta get user:/tests/xercesfile xerces/rootname #> xerces diff --git a/src/plugins/yajl/README.md b/src/plugins/yajl/README.md index 6a0b1188076..4a0f2f0f53a 100644 --- a/src/plugins/yajl/README.md +++ b/src/plugins/yajl/README.md @@ -169,7 +169,7 @@ kdb set user:/tests/yajl/now ', Now' # Elektra arrays require the metakey `array` to the parent. # Otherwise the keys below `user:/tests/yajl/now` would be # interpreted as normal key-value pairs. -kdb meta-set user:/tests/yajl/now array '' +kdb meta set user:/tests/yajl/now array '' kdb set user:/tests/yajl/now/#0 'Neighbors' kdb set user:/tests/yajl/now/#1 'Threads' @@ -219,12 +219,12 @@ sudo kdb mount conf.json user:/tests/yajl yajl kdb set user:/tests/yajl 1 kdb get user:/tests/yajl #> 1 -kdb meta-set user:/tests/yajl type boolean +kdb meta set user:/tests/yajl type boolean kdb set user:/tests/yajl on kdb get user:/tests/yajl #> 1 kdb set user:/tests/yajl/subkey disable -kdb meta-set user:/tests/yajl/subkey type boolean +kdb meta set user:/tests/yajl/subkey type boolean kdb get user:/tests/yajl/subkey #> 0 diff --git a/src/plugins/yamlcpp/README.md b/src/plugins/yamlcpp/README.md index 5ef5e677815..5f88810e539 100644 --- a/src/plugins/yamlcpp/README.md +++ b/src/plugins/yamlcpp/README.md @@ -118,7 +118,7 @@ kdb get user:/tests/yamlcpp/sunny/$(kdb meta get user:/tests/yamlcpp/sunny array #> The Waitress # The plugin also supports empty arrays (arrays without any elements) -kdb meta-set user:/tests/yamlcpp/empty array '' +kdb meta set user:/tests/yamlcpp/empty array '' kdb export user:/tests/yamlcpp/empty yamlcpp #> [] @@ -128,7 +128,7 @@ kdb set user:/tests/yamlcpp/movies "" kdb set user:/tests/yamlcpp/movies/#0 'A Silent Voice' kdb export user:/tests/yamlcpp/movies yamlcpp #> "#0": A Silent Voice -kdb meta-set user:/tests/yamlcpp/movies array '' +kdb meta set user:/tests/yamlcpp/movies array '' kdb export user:/tests/yamlcpp/movies yamlcpp #> - A Silent Voice @@ -151,7 +151,7 @@ kdb set user:/tests/yamlcpp/array "" kdb set user:/tests/yamlcpp/array/#0 scalar kdb set user:/tests/yamlcpp/array/#1/key value kdb set user:/tests/yamlcpp/array/#1/🔑 🙈 -kdb meta-set user:/tests/yamlcpp/array array '#1' +kdb meta set user:/tests/yamlcpp/array array '#1' kdb ls user:/tests/yamlcpp #> user:/tests/yamlcpp/array @@ -206,11 +206,11 @@ sudo kdb mount config.yaml user:/tests/yamlcpp yamlcpp kdb set user:/tests/yamlcpp/#0/map/#1/#0 value kdb set user:/tests/yamlcpp "" -kdb meta-set user:/tests/yamlcpp array '#0' +kdb meta set user:/tests/yamlcpp array '#0' kdb set user:/tests/yamlcpp/#0/map "" -kdb meta-set user:/tests/yamlcpp/#0/map array '#1' +kdb meta set user:/tests/yamlcpp/#0/map array '#1' kdb set user:/tests/yamlcpp/#0/map/#1 "" -kdb meta-set user:/tests/yamlcpp/#0/map/#1 array '#0' +kdb meta set user:/tests/yamlcpp/#0/map/#1 array '#0' kdb file user:/tests/yamlcpp | xargs cat #> - "___dirdata: " #> - map: @@ -270,8 +270,8 @@ kdb meta get user:/tests/yamlcpp/🔑 comment # Add a new key and add some metadata to the new key kdb set user:/tests/yamlcpp/brand new -kdb meta-set user:/tests/yamlcpp/brand comment "The Devil And God Are Raging Inside Me" -kdb meta-set user:/tests/yamlcpp/brand rationale "Because I Love It" +kdb meta set user:/tests/yamlcpp/brand comment "The Devil And God Are Raging Inside Me" +kdb meta set user:/tests/yamlcpp/brand rationale "Because I Love It" # Retrieve metadata kdb meta-ls user:/tests/yamlcpp/brand @@ -290,7 +290,7 @@ We can also invoke additional plugins that use metadata like `type`. ```sh sudo kdb mount config.yaml user:/tests/yamlcpp yamlcpp type kdb set user:/tests/yamlcpp/typetest/number 21 -kdb meta-set user:/tests/yamlcpp/typetest/number check/type short +kdb meta set user:/tests/yamlcpp/typetest/number check/type short kdb set user:/tests/yamlcpp/typetest/number "One" # RET: 5 @@ -377,7 +377,7 @@ kdb meta get user:/tests/yamlcpp/truth type # Add another boolean value kdb set user:/tests/yamlcpp/success 0 -kdb meta-set user:/tests/yamlcpp/success type boolean +kdb meta set user:/tests/yamlcpp/success type boolean kdb get user:/tests/yamlcpp/success #> 0 kdb export user:/tests/yamlcpp/success yamlcpp @@ -481,7 +481,7 @@ directory: sudo kdb mount test.yaml user:/tests/yamlcpp yamlcpp kdb set user:/tests/yamlcpp/directory 'Directory Data' -kdb meta-set user:/tests/yamlcpp/directory comment 'Directory Metadata' +kdb meta set user:/tests/yamlcpp/directory comment 'Directory Metadata' kdb set user:/tests/yamlcpp/directory/file 'Leaf Data' kdb ls user:/tests/yamlcpp/directory diff --git a/src/tools/kdb/factory.hpp b/src/tools/kdb/factory.hpp index 71cad4205ed..5ae747fbb43 100644 --- a/src/tools/kdb/factory.hpp +++ b/src/tools/kdb/factory.hpp @@ -41,7 +41,6 @@ #include #include #include -#include #include #include #include @@ -103,7 +102,6 @@ class Factory m_factory.insert (std::make_pair ("find", std::make_shared> ())); m_factory.insert (std::make_pair ("meta-show", std::make_shared> ())); m_factory.insert (std::make_pair ("meta-rm", std::make_shared> ())); - m_factory.insert (std::make_pair ("meta-set", std::make_shared> ())); m_factory.insert (std::make_pair ("meta-ls", std::make_shared> ())); m_factory.insert (std::make_pair ("plugin-info", std::make_shared> ())); m_factory.insert (std::make_pair ("test", std::make_shared> ())); diff --git a/src/tools/kdb/main.c b/src/tools/kdb/main.c index f48f2adbf3e..4b4f8e3b5fe 100644 --- a/src/tools/kdb/main.c +++ b/src/tools/kdb/main.c @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include @@ -82,7 +81,6 @@ cppCommand cppSubcommands[] = { { "merge", addMergeSpec, execCppMerge }, { "meta-ls", addMetaLsSpec, execCppMetaLs }, { "meta-rm", addMetaRmSpec, execCppMetaRm }, - { "meta-set", addMetaSetSpec, execCppMetaSet }, { "meta-show", addMetaShowSpec, execCppMetaShow }, { "mountOdbc", addMountOdbcSpec, execCppMountOdbc }, { "mv", addMvSpec, execCppMv }, diff --git a/src/tools/kdb/meta-get.c b/src/tools/kdb/meta-get.c index 7b2a411f976..1d38f69e088 100644 --- a/src/tools/kdb/meta-get.c +++ b/src/tools/kdb/meta-get.c @@ -74,6 +74,7 @@ int execMetaGet (KeySet * options, Key * errorKey) { CLI_PRINT (CLI_LOG_NONE, "%s%s", keyString (metaKey), noNewLine ? "" : "\n"); } + keyDel (key); cleanup: if (!noNewLine) @@ -81,7 +82,6 @@ int execMetaGet (KeySet * options, Key * errorKey) printf ("\n"); } keyDel (cascadingParent); - keyDel (key); keyDel (toLookUp); ksDel (conf); kdbClose (handle, errorKey); diff --git a/src/tools/kdb/meta-set.c b/src/tools/kdb/meta-set.c index 08805669b06..ae61db9a484 100644 --- a/src/tools/kdb/meta-set.c +++ b/src/tools/kdb/meta-set.c @@ -9,18 +9,21 @@ #include #include +#include +#include +#include +#include +#include -#include - -#define COMMAND_NAME "meta-set" +#define COMMAND_NAME "meta/set" #define GET_OPTION_KEY(options, name) GET_OPT_KEY (options, COMMAND_BASE_KEY (COMMAND_NAME) "/" name) #define GET_OPTION(options, name) GET_OPT (options, COMMAND_BASE_KEY (COMMAND_NAME) "/" name) void addMetaSetSpec (KeySet * spec) { - ksAppendKey (spec, keyNew (COMMAND_SPEC_KEY (COMMAND_NAME), KEY_META, "description", "Set a metavalue.", KEY_META, "command", - "meta-set", KEY_END)); + ksAppendKey (spec, keyNew (COMMAND_SPEC_KEY (COMMAND_NAME), KEY_META, "description", "Set a metavalue.", KEY_META, "command", "set", + KEY_END)); ksAppendKey (spec, keyNew (COMMAND_SPEC_KEY (COMMAND_NAME) "/force", KEY_META, "description", "Force setting the value", KEY_META, "opt", "f", KEY_META, "opt/long", "force", KEY_META, "opt/arg", "none", KEY_END)); ksAppendKey (spec, keyNew (COMMAND_SPEC_KEY (COMMAND_NAME) "/keyname", KEY_META, "description", "The name of the key", KEY_META, @@ -33,7 +36,76 @@ void addMetaSetSpec (KeySet * spec) ADD_BASIC_OPTIONS (spec, COMMAND_SPEC_KEY (COMMAND_NAME)) } -int execCppMetaSet (int argc, char ** argv) +int execMetaSet (KeySet * options, Key * errorKey) { - return cpp_main (argc, argv); + int ret = 0; + GET_BASIC_OPTIONS + + bool force = false; + tmp = GET_OPTION_KEY (options, "force"); + if (tmp != NULL) + { + elektraKeyToBoolean (GET_OPTION_KEY (options, "force"), &force); + keyDel (tmp); + } + + Key * parentKey = getKeyFromOptions (GET_OPTION (options, "keyname"), errorKey, verbose); + if (parentKey == NULL) + { + RETURN (2) + } + + const char * metaName = GET_OPTION (options, "metaname"); + const char * metaValue = GET_OPTION (options, "metavalue"); + + + if (keyGetNamespace (parentKey) == KEY_NS_NONE || keyGetNamespace (parentKey) == KEY_NS_CASCADING) + { + ELEKTRA_SET_VALIDATION_SYNTACTIC_ERROR (errorKey, "key does not specify a namespace"); + keyDel (parentKey); + RETURN (2) + } + + Key * maybeCascadingParent = keyDup (parentKey, KEY_CP_NAME); + if (!force) + { + keySetNamespace (maybeCascadingParent, KEY_NS_CASCADING); + } + KeySet * conf = ksNew (0, KS_END); + KDB * handle = kdbOpen (NULL, errorKey); + + if (kdbGet (handle, conf, maybeCascadingParent) == -1) + { + ELEKTRA_SET_CLI_ERRORF (errorKey, "could not load '%s': %s", keyName (parentKey), GET_ERR (maybeCascadingParent)); + ret = 5; + goto cleanup; + } + + Key * key = ksLookup (conf, parentKey, KDB_O_NONE); + if (key == NULL) + { + key = keyNew (keyName (parentKey), KEY_END); + keySetMeta (key, metaName, metaValue); + ksAppendKey (conf, key); + keyDel (key); + CLI_PRINT (CLI_LOG_VERBOSE, "Creating key %s\n", keyName (key)); + } + keySetMeta (key, metaName, metaValue); + + if (kdbSet (handle, conf, parentKey) == -1) + { + ret = 5; + ELEKTRA_SET_CLI_ERRORF (errorKey, "could not set meta-value '%s' for '%s': %s", metaName, keyName (parentKey), + GET_ERR (parentKey)); + } + + +cleanup: + keyDel (maybeCascadingParent); + keyDel (parentKey); + keyDel (tmp); + ksDel (conf); + kdbClose (handle, errorKey); + + RETURN (ret) } diff --git a/src/tools/kdb/meta-set.h b/src/tools/kdb/meta-set.h index fa669769f2b..706629b6633 100644 --- a/src/tools/kdb/meta-set.h +++ b/src/tools/kdb/meta-set.h @@ -25,9 +25,9 @@ void addMetaSetSpec (KeySet * spec); * @param errorKey key where errors and warnings should be saved * * @retval 0 set command ran without errors - * @retval 1 errors occurred, keyGetMeta (errorKey, "error/reason") for info + * @retval >0 errors occurred, keyGetMeta (errorKey, "error/reason") for info * */ -int execCppMetaSet (int argc, char ** argv); +int execMetaSet (KeySet * options, Key * errorKey); #endif // ELEKTRA_KDB_META_SET_H diff --git a/src/tools/kdb/meta.c b/src/tools/kdb/meta.c index 240b1868a51..aac1c18282c 100644 --- a/src/tools/kdb/meta.c +++ b/src/tools/kdb/meta.c @@ -6,8 +6,9 @@ * @copyright BSD License (see LICENSE.md or https://www.libelektra.org) */ -#include #include +#include +#include #include #include @@ -20,6 +21,7 @@ command metaSubcommands[] = { { "get", addMetaGetSpec, execMetaGet }, + { "set", addMetaSetSpec, execMetaSet }, }; void addMetaSpec (KeySet * spec) diff --git a/src/tools/kdb/metaset.cpp b/src/tools/kdb/metaset.cpp deleted file mode 100644 index 68e79b757aa..00000000000 --- a/src/tools/kdb/metaset.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/** - * @file - * - * @brief - * - * @copyright BSD License (see LICENSE.md or https://www.libelektra.org) - */ - -#include - -#include -#include - -#include -#include - -using namespace std; -using namespace kdb; - -MetaSetCommand::MetaSetCommand () -{ -} - -int MetaSetCommand::execute (Cmdline const & cl) -{ - if (cl.arguments.size () < 2 || cl.arguments.size () > 3) - { - throw invalid_argument ("Need 2 or 3 arguments"); - } - string metaname = cl.arguments[1]; - - Key k = cl.createKey (0); - string keyname = k.getName (); - - bool cascadingWrite = keyname[0] == '/'; - - Key parentKey = cl.getParentKey (k); - - KeySet conf; - kdb.get (conf, parentKey); - k = conf.lookup (k); - - if (!k) - { - if (cascadingWrite) - { - cerr << "Aborting: A cascading write to a non-existent key is ambiguous." << endl; - return 12; - } - - k = Key (keyname, KEY_END); - // k.setBinary(0, 0); // conceptually maybe better, but would have confusing "binary" metadata - conf.append (k); - if (cl.verbose) cout << "Creating key " << keyname << endl; - } - if (!k.isValid ()) - { - cerr << "Could not create key " << keyname << endl; - return 11; - } - - if (cl.arguments.size () == 2) - { - if (!cl.quiet) cout << "Only two arguments, thus deleting metaname " << metaname << endl; - k.delMeta (metaname); - } - else - { - std::string metavalue = cl.arguments[2]; - if (metaname == "atime" || metaname == "mtime" || metaname == "ctime") - { - stringstream str (metavalue); - time_t t; - str >> t; - if (!str.good ()) throw "conversion failure"; - k.setMeta (metaname, t); - } - else - { - k.setMeta (metaname, metavalue); - } - } - - if (!cl.quiet && cascadingWrite) std::cout << "Using name " << k.getName () << std::endl; - - kdb.set (conf, parentKey); - printWarnings (cerr, parentKey, cl.verbose, cl.debug); - printError (cerr, k, cl.verbose, cl.debug); - - return 0; -} - -MetaSetCommand::~MetaSetCommand () -{ -} diff --git a/src/tools/kdb/metaset.hpp b/src/tools/kdb/metaset.hpp deleted file mode 100644 index 991c8f33754..00000000000 --- a/src/tools/kdb/metaset.hpp +++ /dev/null @@ -1,48 +0,0 @@ -/** - * @file - * - * @brief - * - * @copyright BSD License (see LICENSE.md or https://www.libelektra.org) - */ - -#ifndef METASET_HPP -#define METASET_HPP - -#include "coloredkdbio.hpp" - -#include -#include - -class MetaSetCommand : public Command -{ - kdb::KDB kdb; - -public: - MetaSetCommand (); - ~MetaSetCommand (); - - virtual std::string getShortOptions () override - { - return "qf"; - } - - virtual std::string getSynopsis () override - { - return " "; - } - - virtual std::string getShortHelpText () override - { - return "Set a metavalue."; - } - - virtual std::string getLongHelpText () override - { - return "Meta key are information about keys.\n"; - } - - virtual int execute (Cmdline const & cmdline) override; -}; - -#endif diff --git a/tests/shell/check_error.sh b/tests/shell/check_error.sh index 4eb5203175a..26240f75968 100755 --- a/tests/shell/check_error.sh +++ b/tests/shell/check_error.sh @@ -26,7 +26,7 @@ succeed_if "could not mount root: $ROOT_FILE at $ROOT_MOUNTPOINT" "$KDB" set $ROOT/valueable_data important_unrecoverable_data > /dev/null succeed_if "cannot set valuable data" -"$KDB" meta-set $ROOT/valueable_data trigger/error "C03100" +"$KDB" meta set $ROOT/valueable_data trigger/error "C03100" succeed_if "cannot set metadata" TMPFILE="$(mktempfile_elektra)" diff --git a/tests/shell/check_merge.sh b/tests/shell/check_merge.sh index eadaf299682..9790c143d2d 100755 --- a/tests/shell/check_merge.sh +++ b/tests/shell/check_merge.sh @@ -78,19 +78,19 @@ echo "Testing metadata" "$KDB" set "$OURS_ROOT"/key "init" > /dev/null exit_if_fail "could not set" -"$KDB" meta-set "$OURS_ROOT"/key comment "init" > /dev/null +"$KDB" meta set "$OURS_ROOT"/key comment "init" > /dev/null exit_if_fail "could not set meta" "$KDB" set "$THEIRS_ROOT"/key "init" > /dev/null exit_if_fail "could not set" -"$KDB" meta-set "$THEIRS_ROOT"/key comment "theirs" > /dev/null +"$KDB" meta set "$THEIRS_ROOT"/key comment "theirs" > /dev/null exit_if_fail "could not set meta" "$KDB" set "$BASE_ROOT"/key "init" > /dev/null exit_if_fail "could not set" -"$KDB" meta-set "$BASE_ROOT"/key comment "base" > /dev/null +"$KDB" meta set "$BASE_ROOT"/key comment "base" > /dev/null exit_if_fail "could not set meta" "$KDB" merge "$OURS_ROOT" "$THEIRS_ROOT" "$BASE_ROOT" "$MERGED_ROOT" 2> /dev/null diff --git a/tests/shell/check_spec.sh b/tests/shell/check_spec.sh index 0b1f3075cd0..a46d280a1cc 100755 --- a/tests/shell/check_spec.sh +++ b/tests/shell/check_spec.sh @@ -41,7 +41,7 @@ if is_plugin_available dump && is_plugin_available list && is_plugin_available s [ $? != 0 ] succeed_if "getting cascading should fail if nothing is there" - "$KDB" meta-set spec:$ROOT_MOUNTPOINT/first default 20 + "$KDB" meta set spec:$ROOT_MOUNTPOINT/first default 20 succeed_if "could not set meta" [ "x$("$KDB" get $ROOT_MOUNTPOINT/first)" = "x20" ] diff --git a/tests/shell/check_spec_set.sh b/tests/shell/check_spec_set.sh index 2d002d3aa18..1785edb06e5 100755 --- a/tests/shell/check_spec_set.sh +++ b/tests/shell/check_spec_set.sh @@ -41,7 +41,7 @@ if is_plugin_available dump && is_plugin_available list && is_plugin_available s [ $? != 0 ] succeed_if "getting cascading should fail if nothing is there" - "$KDB" meta-set spec:$ROOT_MOUNTPOINT/first type unsigned_short + "$KDB" meta set spec:$ROOT_MOUNTPOINT/first type unsigned_short succeed_if "could not set meta" "$KDB" set system:$ROOT_MOUNTPOINT/first abcd diff --git a/tests/shell/external/example_codegen_econf.sh b/tests/shell/external/example_codegen_econf.sh index 9018a6a32ce..315c7509857 100644 --- a/tests/shell/external/example_codegen_econf.sh +++ b/tests/shell/external/example_codegen_econf.sh @@ -41,7 +41,7 @@ do_tests() { succeed_if "application could not read default config (spec)" "$KDB" set "$UKEY/root" "1" - "$KDB" meta-set "$UKEY/format" array "#2" + "$KDB" meta set "$UKEY/format" array "#2" "$KDB" set "$UKEY/format/#0/pattern" "*.txt" "$KDB" set "$UKEY/format/#0/indent/style" "tab" diff --git a/tests/shell/external/example_codegen_econf_empty_array_spec.sh b/tests/shell/external/example_codegen_econf_empty_array_spec.sh index c8c9424a2f1..c39f1f55028 100644 --- a/tests/shell/external/example_codegen_econf_empty_array_spec.sh +++ b/tests/shell/external/example_codegen_econf_empty_array_spec.sh @@ -50,7 +50,7 @@ do_tests() { "$KDB" ls "spec:/sw/example/econf/#0" | check_if_parent_exists - "$KDB" meta-set "$KEY/format" array "#2" + "$KDB" meta set "$KEY/format" array "#2" "$KDB" ls "spec:/sw/example/econf/#0" | check_if_parent_exists "$KDB" rm -r "$UKEY" diff --git a/tests/shell/external/example_codegen_menu.sh b/tests/shell/external/example_codegen_menu.sh index 14d10e11987..b2de108e260 100755 --- a/tests/shell/external/example_codegen_menu.sh +++ b/tests/shell/external/example_codegen_menu.sh @@ -56,7 +56,7 @@ do_tests() { EOF - "$KDB" meta-set -f "user:/sw/example/menu/#0/current/menu" "array" "#4" + "$KDB" meta set -f "user:/sw/example/menu/#0/current/menu" "array" "#4" "$KDB" set -f "user:/sw/example/menu/#0/current/menu/#0/name" "Main Menu" "$KDB" set -f "user:/sw/example/menu/#0/current/menu/#1/name" "Menu 1" "$KDB" set -f "user:/sw/example/menu/#0/current/menu/#2/name" "Menu 2" @@ -68,11 +68,11 @@ do_tests() { "$KDB" set -f "user:/sw/example/menu/#0/current/menu/#3/command" 'echo "Hello from Menu 2.1"' "$KDB" set -f "user:/sw/example/menu/#0/current/menu/#4/command" 'echo "Hello from Menu 2.2"' - "$KDB" meta-set -f "user:/sw/example/menu/#0/current/menu/#0/children" "array" "#1" + "$KDB" meta set -f "user:/sw/example/menu/#0/current/menu/#0/children" "array" "#1" "$KDB" set -f "user:/sw/example/menu/#0/current/menu/#0/children/#0" "@/menu/#1" "$KDB" set -f "user:/sw/example/menu/#0/current/menu/#0/children/#1" "@/menu/#2" - "$KDB" meta-set -f "user:/sw/example/menu/#0/current/menu/#2/children" "array" "#1" + "$KDB" meta set -f "user:/sw/example/menu/#0/current/menu/#2/children" "array" "#1" "$KDB" set -f "user:/sw/example/menu/#0/current/menu/#2/children/#0" "@/menu/#3" "$KDB" set -f "user:/sw/example/menu/#0/current/menu/#2/children/#1" "@/menu/#4" diff --git a/tests/shell/external/example_codegen_tree.sh b/tests/shell/external/example_codegen_tree.sh index ca1896ef947..a31c59c557e 100644 --- a/tests/shell/external/example_codegen_tree.sh +++ b/tests/shell/external/example_codegen_tree.sh @@ -76,19 +76,19 @@ do_tests() { "$KDB" set -f "$UKEY/tree/leafB" "" "$KDB" set -f "$UKEY/tree/leafB/text" "leafB" - "$KDB" meta-set -f "$UKEY/tree/root/children" "array" "#3" + "$KDB" meta set -f "$UKEY/tree/root/children" "array" "#3" "$KDB" set -f "$UKEY/tree/root/children/#0" "../../../child1" "$KDB" set -f "$UKEY/tree/root/children/#1" "../../../child2" "$KDB" set -f "$UKEY/tree/root/children/#3" "../../../child4" - "$KDB" meta-set -f "$UKEY/tree/child4/children" "array" "#1" + "$KDB" meta set -f "$UKEY/tree/child4/children" "array" "#1" "$KDB" set -f "$UKEY/tree/child4/children/#0" "../../../grandchildA" "$KDB" set -f "$UKEY/tree/child4/children/#1" "../../../grandchildB" - "$KDB" meta-set -f "$UKEY/tree/grandchildA/children" "array" "#0" + "$KDB" meta set -f "$UKEY/tree/grandchildA/children" "array" "#0" "$KDB" set -f "$UKEY/tree/grandchildA/children/#0" "../../../leafA" - "$KDB" meta-set -f "$UKEY/tree/grandchildB/children" "array" "#0" + "$KDB" meta set -f "$UKEY/tree/grandchildB/children" "array" "#0" "$KDB" set -f "$UKEY/tree/grandchildB/children/#0" "../../../leafB" "$KDB" set -f "$UKEY/root" "../tree/root" diff --git a/tests/shell/external/example_highlevel.sh b/tests/shell/external/example_highlevel.sh index 4b6225da1e5..c342ce4f48b 100644 --- a/tests/shell/external/example_highlevel.sh +++ b/tests/shell/external/example_highlevel.sh @@ -64,7 +64,7 @@ do_tests() { "$KDB" set "$UKEY/myfloatarray/#2" "$MYFLOAT2" "$KDB" set "$UKEY/myfloatarray/#3" "$MYFLOAT3" "$KDB" set "$UKEY/myfloatarray/#4" "$MYFLOAT4" - "$KDB" meta-set "$UKEY/myfloatarray" array "#4" + "$KDB" meta set "$UKEY/myfloatarray" array "#4" ./application succeed_if "application could not read changed config" diff --git a/tests/shell/gen/highlevel/externalspec.check.sh b/tests/shell/gen/highlevel/externalspec.check.sh index c497d3fc83e..e6ea8bd0620 100644 --- a/tests/shell/gen/highlevel/externalspec.check.sh +++ b/tests/shell/gen/highlevel/externalspec.check.sh @@ -107,7 +107,7 @@ cmake .. -DCMAKE_C_COMPILER="@CMAKE_C_COMPILER@" && cmake --build . res=$? if [ "$res" = "0" ]; then - "$KDB" meta-set "user:$MOUNTPOINT/myfloatarray" "array" "#0" + "$KDB" meta set "user:$MOUNTPOINT/myfloatarray" "array" "#0" ./dummy res=$? diff --git a/tests/shell/gen/highlevel/externalwithdefaults.check.sh b/tests/shell/gen/highlevel/externalwithdefaults.check.sh index 4442ca11755..53db24485b1 100644 --- a/tests/shell/gen/highlevel/externalwithdefaults.check.sh +++ b/tests/shell/gen/highlevel/externalwithdefaults.check.sh @@ -107,7 +107,7 @@ cmake .. -DCMAKE_C_COMPILER="@CMAKE_C_COMPILER@" && cmake --build . res=$? if [ "$res" = "0" ]; then - "$KDB" meta-set "user:$MOUNTPOINT/myfloatarray" "array" "#0" + "$KDB" meta set "user:$MOUNTPOINT/myfloatarray" "array" "#0" ./dummy res=$? diff --git a/tests/shell/gen/highlevel/nosetter.check.sh b/tests/shell/gen/highlevel/nosetter.check.sh index 4a2860a630e..4b4b349f449 100644 --- a/tests/shell/gen/highlevel/nosetter.check.sh +++ b/tests/shell/gen/highlevel/nosetter.check.sh @@ -94,7 +94,7 @@ cmake .. -DCMAKE_C_COMPILER="@CMAKE_C_COMPILER@" && cmake --build . res=$? if [ "$res" = "0" ]; then - "$KDB" meta-set "user:$MOUNTPOINT/myfloatarray" "array" "#0" + "$KDB" meta set "user:$MOUNTPOINT/myfloatarray" "array" "#0" ./dummy res=$? diff --git a/tests/shell/gen/highlevel/simple.check.sh b/tests/shell/gen/highlevel/simple.check.sh index 5617e18705c..b2c77f846c3 100644 --- a/tests/shell/gen/highlevel/simple.check.sh +++ b/tests/shell/gen/highlevel/simple.check.sh @@ -109,7 +109,7 @@ cmake .. -DCMAKE_C_COMPILER="@CMAKE_C_COMPILER@" && cmake --build . res=$? if [ "$res" = "0" ]; then - "$KDB" meta-set "user:$MOUNTPOINT/myfloatarray" "array" "#0" + "$KDB" meta set "user:$MOUNTPOINT/myfloatarray" "array" "#0" ./dummy res=$? diff --git a/tests/shell/shell_recorder/CMakeLists.txt b/tests/shell/shell_recorder/CMakeLists.txt index 7e23a5b1680..b1779920a0a 100644 --- a/tests/shell/shell_recorder/CMakeLists.txt +++ b/tests/shell/shell_recorder/CMakeLists.txt @@ -34,6 +34,7 @@ if (ENABLE_KDB_TESTING) add_shell_recorder_test (cli/cli_external_spec.esr) add_shell_recorder_test (cli/cli_get.esr) add_shell_recorder_test (cli/cli_meta_get.esr) + add_shell_recorder_test (cli/cli_meta_set.esr) add_shell_recorder_test (cli/cli_set.esr) add_shell_recorder_test (db_changes.esr) add_shell_recorder_test (hosts.esr REQUIRED_PLUGINS hosts) diff --git a/tests/shell/shell_recorder/cli/cli_external_spec.esr b/tests/shell/shell_recorder/cli/cli_external_spec.esr index fbec6010419..c8f843ad6a2 100644 --- a/tests/shell/shell_recorder/cli/cli_external_spec.esr +++ b/tests/shell/shell_recorder/cli/cli_external_spec.esr @@ -1,19 +1,19 @@ Mountpoint: user:/tests/cli/external < kdb set spec:/sw/elektra/kdb/#0/current/trash "" -< kdb meta-set spec:/sw/elektra/kdb/#0/current/trash external 1 -< kdb meta-set spec:/sw/elektra/kdb/#0/current/trash bin "/path/to/trash.sh" -< kdb meta-set spec:/sw/elektra/kdb/#0/current/trash command "trash" -< kdb meta-set spec:/sw/elektra/kdb/#0/current/trash description "Move a file to trash" +< kdb meta set spec:/sw/elektra/kdb/#0/current/trash external 1 +< kdb meta set spec:/sw/elektra/kdb/#0/current/trash bin "/path/to/trash.sh" +< kdb meta set spec:/sw/elektra/kdb/#0/current/trash command "trash" +< kdb meta set spec:/sw/elektra/kdb/#0/current/trash description "Move a file to trash" < kdb set spec:/sw/elektra/kdb/#0/current/trash/file "" -< kdb meta-set spec:/sw/elektra/kdb/#0/current/trash/file description "The file that should be moved to trash" -< kdb meta-set spec:/sw/elektra/kdb/#0/current/trash/file args/index 0 -< kdb meta-set spec:/sw/elektra/kdb/#0/current/trash/file args indexed +< kdb meta set spec:/sw/elektra/kdb/#0/current/trash/file description "The file that should be moved to trash" +< kdb meta set spec:/sw/elektra/kdb/#0/current/trash/file args/index 0 +< kdb meta set spec:/sw/elektra/kdb/#0/current/trash/file args indexed < kdb set spec:/sw/elektra/kdb/#0/current/trash/force "" -< kdb meta-set spec:/sw/elektra/kdb/#0/current/trash/force description "Delete the file directly" -< kdb meta-set spec:/sw/elektra/kdb/#0/current/trash/force opt f -< kdb meta-set spec:/sw/elektra/kdb/#0/current/trash/force opt/long force -< kdb meta-set spec:/sw/elektra/kdb/#0/current/trash/force opt/arg none +< kdb meta set spec:/sw/elektra/kdb/#0/current/trash/force description "Delete the file directly" +< kdb meta set spec:/sw/elektra/kdb/#0/current/trash/force opt f +< kdb meta set spec:/sw/elektra/kdb/#0/current/trash/force opt/long force +< kdb meta set spec:/sw/elektra/kdb/#0/current/trash/force opt/arg none STDERR: .*trash\s+Move a file to trash.* < kdb --help @@ -21,12 +21,12 @@ STDERR: .*trash\s+Move a file to trash.* STDERR: .*Usage: kdb trash \[OPTION...\] .*file\s+The file that should be moved to trash.* < kdb trash --help -< kdb meta-set spec:/sw/elektra/kdb/#0/current/trash/file description "The file that will be moved to trash" +< kdb meta set spec:/sw/elektra/kdb/#0/current/trash/file description "The file that will be moved to trash" STDERR: .*Usage: kdb trash \[OPTION...\] .*file\s+The file that will be moved to trash.* < kdb trash --help -< kdb meta-set spec:/sw/elektra/kdb/#0/current/trash command "delete" +< kdb meta set spec:/sw/elektra/kdb/#0/current/trash command "delete" STDERR: .*delete\s+Move a file to trash.* < kdb --help diff --git a/tests/shell/shell_recorder/cli/cli_meta_set.esr b/tests/shell/shell_recorder/cli/cli_meta_set.esr new file mode 100644 index 00000000000..c884c7e029e --- /dev/null +++ b/tests/shell/shell_recorder/cli/cli_meta_set.esr @@ -0,0 +1,50 @@ +Mountpoint: user:/tests/cli/metaset + +RET: 11 +STDERR: .*Key 'user:/tests/cli/metaset/testkey' does not exist.* +< kdb meta get $Mountpoint/testkey m1 + +RET: 2 +STDERR: .*'testkey' is not valid key name. +< kdb meta get testkey m1 + +RET: 0 +STDOUT: Create a new key user:/tests/cli/metaset/testkey with string "hello" +< kdb set $Mountpoint/testkey hello + +RET: 0 +< kdb meta set -v $Mountpoint/testkey m1 v1 + +RET: 0 +< kdb meta set $Mountpoint/testkey m2 v2 + +RET: 0 +< kdb meta set $Mountpoint/testkey m3 v3 + +RET: 0 +STDOUT: v2 +< kdb meta get $Mountpoint/testkey m2 + +RET: 0 +STDOUT: v3 +< kdb meta get $Mountpoint/testkey m3 + +RET: 0 +STDOUT: Creating key user:/tests/cli/metaset/testkey1 +< kdb meta set -v $Mountpoint/testkey1 m4 v4 + +RET: 0 +< kdb set user:/sw/elektra/kdb/#0/current/bookmarks/metasettest user:/tests/cli/metaset + +RET: 0 +STDOUT: +< kdb meta set +metasettest/testkey m5 v5 + +RET: 0 +STDOUT: v5 +< kdb meta get +metasettest/testkey m5 + +RET: 0 +< kdb rm user:/sw/elektra/kdb/#0/current/bookmarks/metasettest + +< kdb rm -r $Mountpoint diff --git a/tests/shell/shell_recorder/mathcheck.esr b/tests/shell/shell_recorder/mathcheck.esr index 2a6573ed2d9..75b39ff2665 100644 --- a/tests/shell/shell_recorder/mathcheck.esr +++ b/tests/shell/shell_recorder/mathcheck.esr @@ -14,7 +14,7 @@ Storage: mathcheck < kdb set $Mountpoint/check/gp -< kdb meta-set $Mountpoint/check/gp check/math ":= + ../test0/points ../test1/points" +< kdb meta set $Mountpoint/check/gp check/math ":= + ../test0/points ../test1/points" STDOUT: 10.4 < kdb get $Mountpoint/check/gp @@ -30,7 +30,7 @@ RET: 0 < kdb set $Mountpoint/check/gp -< kdb meta-set $Mountpoint/check/gp check/math ":= + ./test0/points ./test1/points" +< kdb meta set $Mountpoint/check/gp check/math ":= + ./test0/points ./test1/points" STDOUT: 10.4 < kdb get $Mountpoint/check/gp @@ -45,7 +45,7 @@ RET: 0 < kdb set $Mountpoint/check/gp -< kdb meta-set $Mountpoint/check/gp check/math ":= + @/check/test0/points @/check/test1/points" +< kdb meta set $Mountpoint/check/gp check/math ":= + @/check/test0/points @/check/test1/points" STDOUT: 10.4 < kdb get $Mountpoint/check/gp @@ -59,7 +59,7 @@ RET: 0 < kdb set $Mountpoint/sum -< kdb meta-set $Mountpoint/sum check/math ":= + @/key0 @/key1" +< kdb meta set $Mountpoint/sum check/math ":= + @/key0 @/key1" STDOUT: 5 < kdb get $Mountpoint/sum @@ -73,7 +73,7 @@ RET: 0 < kdb set $Mountpoint/sub -< kdb meta-set $Mountpoint/sub check/math ":= - @/key0 @/key1" +< kdb meta set $Mountpoint/sub check/math ":= - @/key0 @/key1" STDOUT: 5 < kdb get $Mountpoint/sub @@ -87,7 +87,7 @@ RET: 0 < kdb set $Mountpoint/mul -< kdb meta-set $Mountpoint/mul check/math ":= * @/key0 @/key1" +< kdb meta set $Mountpoint/mul check/math ":= * @/key0 @/key1" STDOUT: 5 < kdb get $Mountpoint/mul @@ -101,7 +101,7 @@ RET: 0 < kdb set $Mountpoint/div -< kdb meta-set $Mountpoint/div check/math ":= / @/key0 @/key1" +< kdb meta set $Mountpoint/div check/math ":= / @/key0 @/key1" STDOUT: 5 < kdb get $Mountpoint/div @@ -109,7 +109,7 @@ STDOUT: 5 < kdb set $Mountpoint/check/a 3.1 < kdb set $Mountpoint/check/b 4.5 < kdb set $Mountpoint/check/k 7.6 -< kdb meta-set $Mountpoint/check/k check/math "== + ../a ../b" +< kdb meta set $Mountpoint/check/k check/math "== + ../a ../b" ERROR: C03200 < kdb set $Mountpoint/check/k 7.7 diff --git a/tests/shell/shell_recorder/record.esr b/tests/shell/shell_recorder/record.esr index 6792d015355..b53f82bbdc5 100644 --- a/tests/shell/shell_recorder/record.esr +++ b/tests/shell/shell_recorder/record.esr @@ -2,7 +2,7 @@ Mountpoint: user:/test < kdb set user:/test/greeting hello < kdb set user:/test/age 25 -< kdb meta-set user:/test/age meta:/visible false +< kdb meta set user:/test/age meta:/visible false < kdb set user:/test/name Franz < kdb set user:/test/poweruser true @@ -16,7 +16,7 @@ RET: 0 < kdb rm user:/test/greeting < kdb set user:/test/name Hans < kdb set user:/test/gender male -< kdb meta-set user:/test/age meta:/visible true +< kdb meta set user:/test/age meta:/visible true RET: 0 STDOUT: Recording is active for /⏎⏎Added 1 key(s)⏎Modified 2 key(s)⏎Removed 1 key(s)⏎⏎Added key user:/test/gender⏎Modified key user:/test/age⏎Modified key user:/test/name⏎Removed key user:/test/greeting diff --git a/tests/shell/shell_recorder/script.esr b/tests/shell/shell_recorder/script.esr index dbb9e394a35..35078054925 100644 --- a/tests/shell/shell_recorder/script.esr +++ b/tests/shell/shell_recorder/script.esr @@ -19,7 +19,7 @@ RET: 0 STDOUT-REGEX: test.?ey < kdb ls $Mountpoint -< kdb meta-set $Mountpoint/testkey metacomment "comment blaa" +< kdb meta set $Mountpoint/testkey metacomment "comment blaa" < kdb get $Mountpoint/michgibtsgarnicht