forked from ElektraInitiative/libelektra
/
kdb-get.1
151 lines (141 loc) · 4.36 KB
/
kdb-get.1
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "KDB\-GET" "1" "June 2019" "" ""
.
.SH "NAME"
\fBkdb\-get\fR \- Get the value of a key stored in the key database
.
.SH "SYNOPSIS"
\fBkdb get <key name>\fR
.
.P
Where \fBkey name\fR is the name of the key\.
.
.SH "DESCRIPTION"
This command is used to retrieve the value of a key\.
.
.P
If you enter a \fBkey name\fR starting with a leading \fB/\fR, then a cascading lookup will be performed in order to attempt to locate the key\. In this case, using the \fB\-v\fR option allows the user to see the full key name of the key if it is found\.
.
.SH "LIMITATIONS"
Only keys within the mount point or below the \fB<key name>\fR will be considered during a cascading lookup\. A workaround is to pass the \fB\-a\fR option\. Use the command \fBkdb get \-v <key name>\fR to see if an override or a fallback was considered by the lookup\.
.
.SH "RETURN VALUES"
This command will return the following values as an exit status:
.
.TP
0
No errors\.
.
.TP
1\-10
standard exit codes, see kdb(1) \fIkdb\.md\fR
.
.TP
11
No key found\.
.
.SH "OPTIONS"
.
.TP
\fB\-H\fR, \fB\-\-help\fR
Show the man page\.
.
.TP
\fB\-V\fR, \fB\-\-version\fR
Print version info\.
.
.TP
\fB\-p\fR, \fB\-\-profile <profile>\fR
Use a different kdb profile\.
.
.TP
\fB\-C\fR, \fB\-\-color <when>\fR
Print never/auto(default)/always colored output\.
.
.TP
\fB\-a\fR, \fB\-\-all\fR
Consider all of the keys\.
.
.TP
\fB\-n\fR, \fB\-\-no\-newline\fR
Suppress the newline at the end of the output\.
.
.TP
\fB\-v\fR, \fB\-\-verbose\fR
Explain what is happening\. Gives a complete trace of all tried keys\. Very useful to debug fallback and overrides\.
.
.TP
\fB\-d\fR, \fB\-\-debug\fR
Give debug information\. Prints additional debug information in case of errors/warnings\.
.
.SH "EXAMPLES"
.
.nf
# Backup\-and\-Restore: user/tests/get/examples
# We use the `dump` plugin, since some storage plugins, e\.g\. INI,
# create intermediate keys\.
sudo kdb mount get\.ecf user/tests/get/examples/kdb\-get dump
sudo kdb mount get\.ecf spec/tests/get/examples/kdb\-get dump
# Create the keys we use for the examples
kdb set user/tests/get/examples/kdb\-get/key myKey
kdb setmeta /tests/get/examples/kdb\-get/anotherKey default defaultValue
# To get the value of a key:
kdb get user/tests/get/examples/kdb\-get/key
#> myKey
# To get the value of a key using a cascading lookup:
kdb get /tests/get/examples/kdb\-get/key
#> myKey
# To get the value of a key without adding a newline to the end of it:
kdb get \-n /tests/get/examples/kdb\-get/key
#> myKey
# To explain why a specific key was used (for cascading keys):
kdb get \-v /tests/get/examples/kdb\-get/key
#> got 3 keys
#> searching spec/tests/get/examples/kdb\-get/key, found: <nothing>, options: KDB_O_CALLBACK
#> searching proc/tests/get/examples/kdb\-get/key, found: <nothing>
#> searching dir/tests/get/examples/kdb\-get/key, found: <nothing>
#> searching user/tests/get/examples/kdb\-get/key, found: user/tests/get/examples/kdb\-get/key
#> The resulting keyname is user/tests/get/examples/kdb\-get/key
#> The resulting value size is 6
#> myKey
# Output if only a default value is set for a key:
kdb get \-v /tests/get/examples/kdb\-get/anotherKey
#> got 3 keys
#> searching spec/tests/get/examples/kdb\-get/anotherKey, found: spec/tests/get/examples/kdb\-get/anotherKey, options: KDB_O_CALLBACK
#> The key was not found in any other namespace, taking the default from the metadata
#> The resulting keyname is /tests/get/examples/kdb\-get/anotherKey
#> The resulting value size is 13
#> defaultValue
kdb rm user/tests/get/examples/kdb\-get/key
kdb rm spec/tests/get/examples/kdb\-get/anotherKey
sudo kdb umount user/tests/get/examples/kdb\-get
sudo kdb umount spec/tests/get/examples/kdb\-get
.
.fi
.
.P
To use bookmarks:
.
.br
\fBkdb get +kdb/format\fR
.
.P
This command will actually get \fBuser/sw/elektra/kdb/#0/current/format\fR if the bookmarks commands from kdb\-set(1) \fIkdb\-set\.md\fR man pages are executed before\.
.
.SH "SEE ALSO"
.
.IP "\(bu" 4
kdb(1) \fIkdb\.md\fR for how to configure the kdb utility and use the bookmarks\.
.
.IP "\(bu" 4
For more about cascading keys see elektra\-cascading(7) \fIelektra\-cascading\.md\fR
.
.IP "\(bu" 4
To get keys in shell scripts, you also can use kdb\-sget(1) \fIkdb\-sget\.md\fR
.
.IP "\(bu" 4
elektra\-key\-names(7) \fIelektra\-key\-names\.md\fR for an explanation of key names\.
.
.IP "" 0