Files
ahab/src/ctx.rs

23 lines
570 B
Rust

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)
}
}