(active-closing-brace text)Index of the brace closing the :active map, or nil.
Index of the brace closing the `:active` map, or nil.
(active-section text)[start end] indices of the :active map's braces, or nil.
[start end] indices of the `:active` map's braces, or nil.
(append-entry text kw snippet)text with snippet — entries written at column 2 — after the last entry
of the map under kw: at that entry's column, a blank line before it, and
the map's closing brace right after it. Unchanged when there is no map.
`text` with `snippet` — entries written at column 2 — after the last entry of the map under `kw`: at that entry's column, a blank line before it, and the map's closing brace right after it. Unchanged when there is no map.
(column text i)The column of index i in text.
The column of index `i` in `text`.
(entries text kw)The key/value pairs of the map under kw, in order, as maps of :key (the
key's text), :start (the key), :end (past the value) and :from (where
the comments above it begin). nil when there is no such map or it cannot be
read.
The key/value pairs of the map under `kw`, in order, as maps of `:key` (the key's text), `:start` (the key), `:end` (past the value) and `:from` (where the comments above it begin). nil when there is no such map or it cannot be read.
(inject-key! path key-str snippet {:keys [dry-run?]})Add snippet to the :active map of the config at path.
Returns :written, :already-present, :no-active-section, or :no-file.
With dry-run?, returns what it would have done and writes nothing.
Add `snippet` to the `:active` map of the config at `path`. Returns `:written`, `:already-present`, `:no-active-section`, or `:no-file`. With `dry-run?`, returns what it would have done and writes nothing.
(insert-before-active-close text snippet)text with snippet inserted just inside the :active map's closing brace.
Returns text unchanged when there is no :active section — the caller
decides whether that is an error.
`text` with `snippet` inserted just inside the `:active` map's closing brace. Returns text unchanged when there is no `:active` section — the caller decides whether that is an error.
(insert-into text kw snippet)text with snippet inserted just inside the closing brace of the map
under kw, or unchanged when there is none.
`text` with `snippet` inserted just inside the closing brace of the map under `kw`, or unchanged when there is none.
(key-status text key-str):already-present when key-str is a key in the :active map, else
:absent.
Two mistakes a substring search over the whole file makes, both of which report a module as configured while writing nothing:
:wagoe/payment is a substring of :wagoe/payment-provider, which the
shipped dev config already contains. So are route/router,
setting/settings, metric/metrics, log/logging — six plausible module names
in one file.:wagoe/h2 appears only under :inactive, and :wagoe/cache only in a
comment. Reporting those as present is the configured-and-switched-off
outcome this namespace exists to avoid.A value naming the key, #ig/ref :wagoe/jobs, is not the key. Only a map
whose entries cannot be read falls back to searching its text.
`:already-present` when `key-str` is a key in the `:active` map, else `:absent`. Two mistakes a substring search over the whole file makes, both of which report a module as configured while writing nothing: - `:wagoe/payment` is a substring of `:wagoe/payment-provider`, which the shipped dev config already contains. So are route/router, setting/settings, metric/metrics, log/logging — six plausible module names in one file. - `:wagoe/h2` appears only under `:inactive`, and `:wagoe/cache` only in a comment. Reporting those as present is the configured-and-switched-off outcome this namespace exists to avoid. A value naming the key, `#ig/ref :wagoe/jobs`, is not the key. Only a map whose entries cannot be read falls back to searching its text.
(line-ending text)The file's own line ending, so inserted lines match it.
The file's own line ending, so inserted lines match it.
(reindent snippet col nl)snippet, written at column 2, moved to column col, lines ending in nl.
The first line is left as it is: the caller places it.
`snippet`, written at column 2, moved to column `col`, lines ending in `nl`. The first line is left as it is: the caller places it.
(root-map text)[open close] indices of the braces of the file's top-level map, or nil.
[open close] indices of the braces of the file's top-level map, or nil.
(section text kw)[start end] indices of the braces of the map under the top-level key kw
(":active", ":inactive"), or nil.
Only the root map's own keys count, matched exactly: a nested :active, or
:active-profiles, is not the section. nil too when the value is not a
literal map (#include, #profile), since there is nothing to edit.
[start end] indices of the braces of the map under the top-level key `kw`
(":active", ":inactive"), or nil.
Only the root map's own keys count, matched exactly: a nested `:active`, or
`:active-profiles`, is not the section. nil too when the value is not a
literal map (`#include`, `#profile`), since there is nothing to edit.(snippet-entries snippet)The entries of snippet, a map body without its braces as modules write
it, in order, as maps of :key (the key's text) and :text (the entry
with the comment lines above it). nil when it cannot be read.
The entries of `snippet`, a map body without its braces as modules write it, in order, as maps of `:key` (the key's text) and `:text` (the entry with the comment lines above it). nil when it cannot be read.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |