diff options
Diffstat (limited to 'contrib/ls-config/sample')
-rw-r--r-- | contrib/ls-config/sample/config | 23 | ||||
-rwxr-xr-x | contrib/ls-config/sample/script | 68 |
2 files changed, 91 insertions, 0 deletions
diff --git a/contrib/ls-config/sample/config b/contrib/ls-config/sample/config new file mode 100644 index 0000000..abe7dda --- /dev/null +++ b/contrib/ls-config/sample/config @@ -0,0 +1,23 @@ +grp : +{ + value = 10; + name = "sample"; +}; +lst = ( + { + name = "sample"; + }, + { + comment = "sample secong group"; + val = 10.2; + } ); +info = "more info about types in libconfig9 documentations"; +arr = [ 10, 20, 30 ]; +integer = 100; +longint = 100L; +flo = 100.01; +boolean : +{ + truevalue = true; + falsevalue = false; +}; diff --git a/contrib/ls-config/sample/script b/contrib/ls-config/sample/script new file mode 100755 index 0000000..70fe124 --- /dev/null +++ b/contrib/ls-config/sample/script @@ -0,0 +1,68 @@ +#!/bin/bash + +#title :script +#description :this script only demonstrate usage of ls-config +#author :Łukasz A. Grabowski <www@lucas.net.pl> +#date :20130928 +#version :1.0.3 +#notes :This only read one value from configuration file +# :this script MUST be run from subdirectory of dir +# :where ls-config (bin) and lslib-core are stored +# :to place script in other places You must reconfigure paths +#bash_version :4.2.37(1)-release +#copywrite :Copyright (C) 2013 Łukasz A. Grabowski +#license :This program is free software: you can redistribute +# :it and/or modify it under the terms of the GNU General +# :Public License as published by the Free Software +# :Foundation, either version 2 of the License or +# :any later version. +# : +# :This program is distributed in the hope that it will +# :be useful, but WITHOUT ANY WARRANTY; without even the +# :implied warranty of MERCHANTABILITY or FITNESS FOR +# :A PARTICULAR PURPOSE. See the GNU General Public +# :License for more details. +# : +# :You should have received a copy of the GNU General +# :Public License along with this program. If not, see +# :http://www.gnu.org/licenses/. +#======================================================================= + + +#set app flag +LS_EXEC=1 + +#set configuration directory +CFGD="./" + +#source bash library to manipulate config +source ../lslib-core + +#path direcrories onlny for this sample +PACD="../" +LIBD="" +#end path + +#read data from configuration file +TEST=$(cfg_f_g "config" "info") +ERR="$?" + +#show data +echo "Info value: $TEST" +echo "Reading error: $ERR" + +#show other method of reading value: + +#output space and info +echo "" +echo "Reading using binary:" + +#read data from configuration file +TEST=$(${PACD}ls-config -f config --get="info" -vq) +ERR="$?" + +#show data +echo "Info value: $TEST" +echo "Reading error: $ERR" + +exit 0; |