gdritter repos ndbl / c2e5181
More explanation Getty Ritter 9 years ago
1 changed file(s) with 26 addition(s) and 10 deletion(s). Collapse all Expand all
4646 have this property in practice.
4747
4848 As a pleasant but unintended side effect, an executable bash file that
49 does nothing but define environment variables is trivially an NDBL
49 does nothing but define environment variables is often trivially an NDBL
5050 file.
5151
5252 Structure of an NDBL Document
8787 Examples With Explanation
8888 -------------------------
8989
90 In the examples below, I will use `{ key: value }` as shorthand to represent a
91 multimap.
90 In the examples below, I will use `[ key: value ]` as shorthand to represent an
91 ordered sequence of key-value pairs.
9292
9393 host=machine1
9494 host=machine2
9595
9696 This parses to the following structure:
9797
98 [{host:machine1},{host:machine2}]
98 [[ "host": "machine1" ], [ "host": "machine2" ]]
9999
100100 Adding indentation merges the two multisets, as the second line is now
101101 considered a 'cotinuation' of the first group.
105105
106106 This becomes
107107
108 [{host:machine1,host:machine2}]
108 [[ "host": "machine1", "host": "machine2" ]]
109109
110110 A third non-indented line will then start a new group:
111111
115115
116116 This becomes
117117
118 [{host:machine1,host:machine2},{host:machine3}]
118 [ [ "host": "machine1"
119 , "host": "machine2"
120 ]
121 , [ "host": "machine3" ]
122 ]
119123
120 Empty values are permitted, and can be used as a tag of sorts.
124 Empty values are permitted, and are idiomatically used as a 'header' for a group
125 of configuration options:
121126
122127 database=
123128 file=file1.txt
126131
127132 This becomes
128133
129 [{database:},{file:file1.txt},{file:file2.txt},{file:file3.txt}]
134 [["database": "", "file": "file1.txt", "file": "file2.txt", "file": "file3.txt"]]
130135
131136 Comments are allowed but must come after a whitespace character, which
132137 means that the following document contains no comments:
135140
136141 This becomes
137142
138 [{key:value#hello}]
143 [["key": "value#hello"]]
139144
140145 But this document does contain a comment:
141146
143148
144149 This becomes
145150
146 [{key:value}]
151 [["key": "value"]]
147152
148153 Comments can begin a line, as well.
149154
154159 port=22
155160 user=abu-al-walid
156161 nicename="H-G Remote Server"
162
163 This document corresponds to
164
165 [ [ "host": "hg-remote"
166 , "portforwarding": ""
167 , "hostname": "hunter-gratzner.example.com"
168 , "port": "22"
169 , "user": "abu-al-walid"
170 , "nicename": "H-G Remote Server"
171 ]
172 ]
157173
158174 NDBL does not provide arbitrarily-nested hierarchical strutures,
159175 a list type, a numeric type, a boolean type, or other niceties. This does not