pub struct Context {
pub working_dir: PathBuf,
pub config_path: Option<PathBuf>,
pub vars: HashMap<String, String>,
pub interpreter: Vec<String>,
pub task_stack: Vec<String>,
pub verbosity: Verbosity,
}Expand description
Execution context that tracks state during task execution
Fields§
§working_dir: PathBufCurrent working directory
config_path: Option<PathBuf>Configuration file path
vars: HashMap<String, String>Variables (from options, args, set-environment, etc.)
interpreter: Vec<String>Custom interpreter (e.g., [“bash”, “-c”])
task_stack: Vec<String>Stack of tasks being executed (for detecting recursion)
verbosity: VerbosityVerbosity level
Implementations§
Source§impl Context
impl Context
Sourcepub fn with_working_dir(self, dir: PathBuf) -> Self
pub fn with_working_dir(self, dir: PathBuf) -> Self
Create a context with a specific working directory
Sourcepub fn with_config_path(self, path: PathBuf) -> Self
pub fn with_config_path(self, path: PathBuf) -> Self
Set the configuration file path
Sourcepub fn with_interpreter(self, interpreter: Vec<String>) -> Self
pub fn with_interpreter(self, interpreter: Vec<String>) -> Self
Set the interpreter
Sourcepub fn with_verbosity(self, verbosity: Verbosity) -> Self
pub fn with_verbosity(self, verbosity: Verbosity) -> Self
Set verbosity level
Sourcepub fn is_task_in_stack(&self, task_name: &str) -> bool
pub fn is_task_in_stack(&self, task_name: &str) -> bool
Check if a task is in the execution stack (detect recursion)
Sourcepub fn current_task(&self) -> Option<&String>
pub fn current_task(&self) -> Option<&String>
Get the current task name (top of stack)
Sourcepub fn task_names(&self) -> Vec<String>
pub fn task_names(&self) -> Vec<String>
Get all task names in the stack
Sourcepub fn config_dir(&self) -> PathBuf
pub fn config_dir(&self) -> PathBuf
Get the directory for the config file (or current dir)
Sourcepub fn print_info(&self, message: &str)
pub fn print_info(&self, message: &str)
Print info message
Sourcepub fn print_error(&self, message: &str)
pub fn print_error(&self, message: &str)
Print error message
Sourcepub fn print_debug(&self, message: &str)
pub fn print_debug(&self, message: &str)
Print debug message (only in verbose mode)
Sourcepub fn print_task_start(&self, task_name: &str)
pub fn print_task_start(&self, task_name: &str)
Print task start message
Sourcepub fn print_task_complete(&self, task_name: &str)
pub fn print_task_complete(&self, task_name: &str)
Print task complete message
Sourcepub fn print_task_skip(&self, task_name: &str, reason: &str)
pub fn print_task_skip(&self, task_name: &str, reason: &str)
Print task skip message
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Context
impl RefUnwindSafe for Context
impl Send for Context
impl Sync for Context
impl Unpin for Context
impl UnwindSafe for Context
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more