aboutsummaryrefslogtreecommitdiff
path: root/contrib/ls-config/doc/bash.api.txt
blob: 762f6000b8cc811ca9b2d2a0cf89b07adb0e90f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
Instalation:
------------

First of all, You must place ls-config binary and lslib-core bash
script in the same directory (default: /usr/share/ls/lib)

Next in lslib-core header chcange configuration:
PACD tu point to parent directory of paced files
then LIBD must point relative (tu PACD) to directory 
whrere script placed

Usage:
------

In You bash script, first of all define LS_EXEC variable,
and set his value to 1. (It protect lslib-core) to run
standalone

Next, source library:
source /usr/share/ls/lib/lslib-core

After thet You can use following function:

Functions:
----------

cfg_g $PATH               - this echo variable value of given PATH 
                            and return error code
cfg_t $PATH               - this echo variable type of given PATH 
                            and return error code
cfg_c $PATH               - this echo cout of variable elements 
                            and return error code
cfg_s $PATH $DATA [$TYPE] - this set variable of given PATH or create new
                            variable valuse are set to DATA, and if this
                            create new variable, variable will be type TYPE
cfg_u $PATH               - this unset (remove) variable of given PATH
                            and return error code
cfg_f_g $FILE $PATH       - same as cfg_g, but operate on given FILE
cfg_f_t $FILE $PATH       - same as cfg_t, but operate on given FILE
cfg_f_c $FILE $PATH       - same as cfg_c, but operate on given FILE
cfg_f_s $FILE $PATH $DATA [$TYPE] - same as cfg_s, but operate on given FILE
cfg_f_u $FILE $PATH       - same as cfg_u, but operate on given FILE

Configuration files:
--------------------

By default configuration file are placed in /etc/ls/
with the same name as script file name
(used in cfg_g, cfg_t, cfg_c, cfg_s, cfg_u)

But if You need, You can use any location of configuration file
by using cfg_f_* functions, giving configuration file location as
first argument

Detailed configuration file shema are publicated on:
http://www.hyperrealm.com/libconfig/
And his gramar on:
http://www.hyperrealm.com/libconfig/libconfig_manual.html#Configuration-Files

there are only short describe:
configuration = setting-list | empty
setting-list = setting | setting-list setting
setting = name (":" | "=") value (";" | "," | empty)
value = scalar-value | array | list | group
value-list = value | value-list "," value
scalar-value = boolean | integer | integer64 | hex | hex64 | float | string
scalar-value-list = scalar-value | scalar-value-list "," scalar-value
array = "[" (scalar-value-list | empty) "]"
list = "(" (value-list | empty) ")"
group = "{" (setting-list | empty) "}"
empty =

smaple configuration file and script are available on sample/ directory
config - samble configuration file
script - sample script, then read info variable from config file