Elektra
0.8.21
|
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
/examples/mini` sudo kdb mount mini.ini /examples/mini mini
kdb set /examples/mini/key value #> Using name user/examples/mini/key #> Create a new key user/examples/mini/key with string "value" kdb set /examples/mini/mi/mi/mr beaker #> Using name user/examples/mini/mi/mi/mr #> Create a new key user/examples/mini/mi/mi/mr with string "beaker"
kdb export /examples/mini mini #> key=value #> mi/mi/mr=beaker
echo "๐ = ๐ฆ" >> kdb file /examples/mini
echo "level1/level2 = ๐พ" >> kdb file /examples/mini
/examples/mini
contains four key value pairskdb ls /examples/mini #> user/examples/mini/key #> user/examples/mini/level1/level2 #> user/examples/mini/mi/mi/mr #> user/examples/mini/๐
/examples/mini/๐
contains the correct valuekdb get "/examples/mini/๐" #> ๐ฆ
kdb rm -r /examples/mini sudo kdb umount /examples/mini
sudo kdb mount mini.ini /examples/mini mini
kdb set /examples/mini/key ';#=\' #> Using name user/examples/mini/key #> Create a new key user/examples/mini/key with string ";#=\"
kdb file /examples/mini | xargs cat #> key=\;#\=\
kdb get /examples/mini/key #> ;#=\
;
and #
characters, then theyecho 'background = #0F0F0F ; Background color' >> kdb file /examples/mini
echo 'foreground = #FFFFFF # Foreground color' >> kdb file /examples/mini
kdb get /examples/mini/background #> #0F0F0F kdb get /examples/mini/foreground #> #FFFFFF
kdb rm -r /examples/mini sudo kdb umount /examples/mini
sudo kdb mount mini.ini /examples/mini mini
echo '[section]' >> kdb file /examples/mini
printf 'key="multi\nline"' >> kdb file /examples/mini
key
, sincekdb ls /examples/mini 2> stderr.txt #> user/examples/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 /examples/mini
key
also contains the double quote symbol, since mINI doeskdb get /examples/mini/key #> "multi
rm stderr.txt kdb rm -r /examples/mini sudo kdb umount /examples/mini ```