Expand description
Reading configuration — and reading it the way git itself does.
Everything this project can be tuned with is a git config key, so the
honest implementation of that promise is to let git do the parsing.
git config --type=bool implements git-config(1) by definition: on,
yes, 1, an empty value, and every capitalisation of each. A hand-rolled
matches!(v, "true" | "1" | "yes") is our own dialect wearing git’s
clothes, and it had already drifted — git config amont.fix on looked
like it worked and did not.
The exit code carries the part that matters most:
| exit | means |
|---|---|
| 0 | the key is set, and stdout is git’s normalised value |
| 1 | the key is not set anywhere git looked |
| 128 | the key is set to something git refuses to parse, and said so on stderr |
Collapsing 1 and 128 into “no” is the bug this module exists to prevent: a
limit you believe you raised and did not is exactly the silent-config
failure that hook.skip announcements were introduced for. So a bad value
falls back to the shipped default and says so, once per key per run.
Enums§
- Scope
- Where a key’s value came from, for the commands whose job is reading configuration back.
- Value
- What a key said. Three answers, because “unset” is a state this project
makes decisions with —
amont.commit.gitmojihas four meanings and one of them is absence.
Functions§
- boolean
- boolean_
or - complain
- Say once, per key, that a configured value could not be used.
- enumerated
- One of a fixed set of words, compared case-insensitively.
- enumerated_
or - integer
- An integer, in git’s own spelling — which includes the
k/m/gsuffixes git accepts, since--type=intexpands them before we see them. - integer_
or - An integer, clamped to what the setting can actually mean.
- is_
present - Is
keyamong the namespresentreturned? Case-insensitive, because git config key names are. - present
- Which keys under
prefixare set at all — one git call for the whole family. - scope_
of git config --show-origin --get <key>→ which file it came from.