gdritter repos ndbl / c5cca2a
Updated readme a bit Getty Ritter 10 years ago
1 changed file(s) with 21 addition(s) and 4 deletion(s). Collapse all Expand all
1717 remote=main
1818 ip=192.168.1.300
1919 user=guest
20 key=public.pem
20 key=public.key
2121
2222 Rationale
2323 ---------
3333 [TOML](https://github.com/mojombo/toml), both of which are significantly
3434 more complicated than NDBL.
3535
36 For incredibly basic configurations—in particular, if you do not use
37 grouping at all—an NDBL file is also an executable BASH file which
38 defines a slew of environment variables.
39
3640 Structure of an NDBL Document
3741 -----------------------------
3842
3943 All NDBL documents consist of a sequence of multisets of key-value pairs.
4044 All data is represented as text; it is the responsibility of the library
41 user to parse numeric data, boolean data, &c, during use.
45 user to parse numeric data, boolean data, &c, during use. NBDL requires
46 the use of UTF-8 as input and produces UTF-8 chunks when parsed.
4247
4348 A _comment_ is introduced by any whitespace (including newlines)
4449 followed by a pound sign (`#`) and lasts until the end of a line. This
6469 -------------------------
6570
6671 In the examples below, I will use `{ key: value }` as shorthand to represent a
67 multiset.
72 multimap.
6873
6974 host=machine1
7075 host=machine2
125130
126131 # WARNING: do not change
127132 host=hg-remote
128 portforwarding=
133 portforwarding= # subject to change
129134 hostname=hunter-gratzner.example.com
130135 port=22
131136 user=abu-al-walid
132137 nicename="H-G Remote Server"
138
139 Haskell API
140 -----------
141
142 Three sets of `encode`/`decode` pairs are provided. One produces a sequential
143 list of multimap (as implemented by the `multimap` package); one produces
144 a sequential list of lists of pairs; and one
145 flattens the list of lists into just a list, for simple situations in which
146 grouping is irrelevant to the configuration. Each function pair guarantees
147 that `fromJust . decode . encode == id`, although be aware that
148 `encode . fromJust . decode == id` is not always true, as multiple valid NDBL
149 documents may correspond to a single NDBL representation.