This example application reads its configuration from the KDB using code-generated functions. It then prints an EditorConfig file created from the configuration inside the KDB.
# execute in the current directory or replace $PWD accordingly
mkdir "$PWD/cmake/build" && cd "$PWD/cmake/build"
cmake ..
cmake --build .
sudo kdb mount -R noresolver codegen_econf_example.conf "spec:/sw/example/econf/#0/current" specload "app=$PWD/application"
sudo kdb spec-mount "/sw/example/econf/#0/current"
# execute in the current directory or replace $PWD accordingly
cd "$PWD/pkgconfig"
make
sudo kdb mount -R noresolver codegen_econf_example.conf "spec:/sw/example/econf/#0/current" specload "app=$PWD/application"
sudo kdb spec-mount "/sw/example/econf/#0/current"
To run the application, simply execute:
# execute in the current directory or replace $PWD accordingly
"$PWD/cmake/build/application"
# execute in the current directory or replace $PWD accordingly
# "$PWD/pkgconfig/application"
The supported KDB configuration is described in spec.ini
.
EditorConfig uses sections to match file patterns. In the KDB config, for each such section you should
create an entry in the array format/#
. The pattern used to match files is given in format/#/pattern
.
The other keynames used are similar to the keys used by EditorConfig, so they should be self-explanatory. The values however are sometimes different, to fit Elektra's type system:
- the general
unset
option is not supported everywhere format/#/indent/size
uses0
instead oftab
format/#/tabwidth
allows0
, but this is equivalent tounset
.1
and0
are used for booleans instead oftrue
/false
format/#/linelength
uses0
instead ofoff