Expand description
Interactive setup wizard for krypt setup.
Reads [prompts.<name>] sections from .krypt.toml, asks the user
questions via Prompter, and writes the collected values to destination
files using one of four built-in writers:
gitconfig— merges key=value pairs into a git-style ini file.hypr_vars— patches$VAR = valuelines in a Hyprland config.env— writesexport K=Vlines to a shell env file.generic_template— substitutes{{key}}placeholders in a template.
§Default resolution order (first hit wins)
read_var = "X"— read$X = <value>from the destination file.default_fromprefix:git:<key>— shell out togit config --get <key>. We deliberately keep this one shell-out because git-level user config (name, email, signing key) lives inside git’s own config system and cannot be read any other way without reimplementing the full git config search order. gix is only used for repo operations inupdate; it is not used here.env:<VAR>— read env var.field:<key>— value of an earlier field in this same run.read_var:<X>— same asread_varshorthand.
default = <toml value>.- No default.
Structs§
- Fake
GitConfig - Fake git config for tests.
- Real
GitConfig - Shells out to the system
gitbinary. - Real
Prompter - Dialoguer-backed prompter used in production.
- Scripted
Prompter - Pre-canned answers for unit tests. Pops answers in FIFO order.
- Setup
Opts - Inputs to
setup. - Setup
Report - Summary of a
setuprun. - YesPrompter
- Returns each field’s computed default without prompting. Errors if a required field has no default.
Enums§
- Resolve
Error - Errors from the default resolver.
- Setup
Error - Errors from
setup.
Traits§
- GitConfig
- Abstraction over
git config --get <key>so tests can avoid a realgitbinary. - Prompter
- Abstraction over interactive prompts so tests can inject scripted answers.
Functions§
- setup
- Run the interactive setup wizard.
- setup_
with_ destinations - Run setup with per-section destination paths and optional template sources.
- setup_
with_ destinations_ and_ srcs - Full entry point with both destination and source paths.
- write_
generic_ template - Substitute
{{key}}placeholders in a template file and write todst. Missing keys leave the placeholder intact.