Skip to main content

Module dispatch

Module dispatch 

Source
Expand description

Generic krypt <group> <name> dispatcher.

This module is the core logic behind both krypt menu and any arbitrary user-defined group (krypt battery report, krypt kanata toggle, etc.). It keeps the CLI thin by handling config loading, platform filtering, dry-run formatting, and runner dispatch from here.

§Step interpolation note

Steps use {name} for named captures and {0}..{9} for positional args forwarded via krypt <group> <name> -- arg0 arg1 .... The ${VAR} syntax (e.g. ${HOME}) is not expanded inside step args — that is a .krypt.toml-level path-variable syntax resolved by crate::paths::Resolver at config-load time, not at step-execution time. If a step needs $HOME, use run = ["sh", "-c", "echo $HOME"] or capture it into a named variable first.

The resolver is used by predicate evaluation (file_exists:${HOME}/.bashrc etc.) because predicate.rs calls Resolver::resolve internally.

Structs§

DispatchListEntry
One entry returned by list_in_group.
DispatchOpts
Options shared by both listing and running dispatch groups.
DispatchReport
Summary of a completed dispatch run.

Enums§

DispatchError
Everything that can go wrong in the dispatch subsystem.

Functions§

list_groups
Return all distinct group names present in the config, sorted.
list_in_group
Return all commands defined in the given group.
run_in_group
Run the named command in the given group using production process/notify/prompt implementations.
run_in_group_with
Run the named command in the given group with injected dependencies (used by tests and dry-run).