refactor: put the dry-run and quiet checks on Ctx

This commit is contained in:
2026-09-09 12:32:55 +00:00
parent d9439253fd
commit b40dfe6124
10 changed files with 253 additions and 217 deletions

View File

@@ -1,6 +1,22 @@
use crate::cmd::Compose;
use crate::fsops::Fs;
// how ahab was invoked, handed to everything that runs commands or writes files
pub struct Ctx {
pub verbose: bool,
pub dry_run: bool,
pub quiet: bool,
}
impl Ctx {
// the two things these flags actually decide, asked for by name rather than
// read field by field wherever they are needed: a dry run writes nothing,
// and --quiet stops compose narrating
pub fn fs(&self) -> Fs<'_> {
Fs::new(self)
}
pub fn compose(&self) -> Compose<'_> {
Compose::new(self)
}
}