Updated readme a bit
Getty Ritter
11 years ago
| 17 | 17 | remote=main |
| 18 | 18 | ip=192.168.1.300 |
| 19 | 19 | user=guest |
| 20 |
key=public. |
|
| 20 | key=public.key | |
| 21 | 21 | |
| 22 | 22 | Rationale |
| 23 | 23 | --------- |
| 33 | 33 | [TOML](https://github.com/mojombo/toml), both of which are significantly |
| 34 | 34 | more complicated than NDBL. |
| 35 | 35 | |
| 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 | ||
| 36 | 40 | Structure of an NDBL Document |
| 37 | 41 | ----------------------------- |
| 38 | 42 | |
| 39 | 43 | All NDBL documents consist of a sequence of multisets of key-value pairs. |
| 40 | 44 | 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. | |
| 42 | 47 | |
| 43 | 48 | A _comment_ is introduced by any whitespace (including newlines) |
| 44 | 49 | followed by a pound sign (`#`) and lasts until the end of a line. This |
| 64 | 69 | ------------------------- |
| 65 | 70 | |
| 66 | 71 | In the examples below, I will use `{ key: value }` as shorthand to represent a |
| 67 |
multi |
|
| 72 | multimap. | |
| 68 | 73 | |
| 69 | 74 | host=machine1 |
| 70 | 75 | host=machine2 |
| 125 | 130 | |
| 126 | 131 | # WARNING: do not change |
| 127 | 132 | host=hg-remote |
| 128 |
portforwarding= |
|
| 133 | portforwarding= # subject to change | |
| 129 | 134 | hostname=hunter-gratzner.example.com |
| 130 | 135 | port=22 |
| 131 | 136 | user=abu-al-walid |
| 132 | 137 | 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. | |