Elektra
0.8.24
|
The โmaybe this is not INIโ plugin (mini
) is a very simple storage plugin loosely based on the INI file format. Since this plugin does not support sections it might be more appropriate to say that it is based on the .properties format, used in many Java applications.
The following example shows basic usage of the mini
plugin.
`` <h1>Mount mini plugin to cascading namespace
/tests/mini` sudo kdb mount mini.ini /tests/mini mini
kdb set /tests/mini/key value #> Using name user/tests/mini/key #> Create a new key user/tests/mini/key with string "value" kdb set /tests/mini/mi/mi/mr beaker #> Using name user/tests/mini/mi/mi/mr #> Create a new key user/tests/mini/mi/mi/mr with string "beaker"
kdb export /tests/mini mini #> key=value #> mi/mi/mr=beaker
echo "๐ = ๐ฆ" >> kdb file /tests/mini
echo "level1/level2 = ๐พ" >> kdb file /tests/mini
/tests/mini
contains four key value pairskdb ls /tests/mini #> user/tests/mini/key #> user/tests/mini/level1/level2 #> user/tests/mini/mi/mi/mr #> user/tests/mini/๐
/tests/mini/๐
contains the correct valuekdb get "/tests/mini/๐" #> ๐ฆ
kdb rm -r /tests/mini sudo kdb umount /tests/mini
sudo kdb mount mini.ini /tests/mini mini
kdb set /tests/mini/key ';#=\' #> Using name user/tests/mini/key #> Create a new key user/tests/mini/key with string ";#=\"
kdb file /tests/mini | xargs cat #> key=\;#\=\
kdb get /tests/mini/key #> ;#=\
;
and #
characters, then theyecho 'background = #0F0F0F ; Background color' >> kdb file /tests/mini
echo 'foreground = #FFFFFF # Foreground color' >> kdb file /tests/mini
kdb get /tests/mini/background #> #0F0F0F kdb get /tests/mini/foreground #> #FFFFFF
kdb rm -r /tests/mini sudo kdb umount /tests/mini
sudo kdb mount mini.ini /tests/mini mini
echo '[section]' >> kdb file /tests/mini
printf 'key="multi\nline"' >> kdb file /tests/mini
key
, sincekdb ls /tests/mini 2> stderr.txt #> user/tests/mini/key
cat stderr.txt | grep 'Reason:' | sed 's/^[[:space:]]*//' #> Reason: Line 1: โ[section]โ is not a valid key value pair #> Reason: Line 3: โline"โ is not a valid key value pair
ini
and ni
plugin, mINI does not support metadata.kdb lsmeta /tests/mini
key
also contains the double quote symbol, since mINI doeskdb get /tests/mini/key #> "multi
rm stderr.txt kdb rm -r /tests/mini sudo kdb umount /tests/mini ```