committed by
GitHub
parent
ce7af763bb
commit
6692b74850
@@ -1,6 +1,7 @@
|
||||
#![allow(dead_code)]
|
||||
use crate::config::Config;
|
||||
use crate::executor::RunType;
|
||||
use crate::git::Git;
|
||||
use directories::BaseDirs;
|
||||
#[cfg(unix)]
|
||||
use std::path::PathBuf;
|
||||
@@ -9,6 +10,7 @@ pub struct ExecutionContext<'a> {
|
||||
run_type: RunType,
|
||||
#[cfg(unix)]
|
||||
sudo: &'a Option<PathBuf>,
|
||||
git: &'a Git,
|
||||
config: &'a Config,
|
||||
base_dirs: &'a BaseDirs,
|
||||
}
|
||||
@@ -18,22 +20,25 @@ impl<'a> ExecutionContext<'a> {
|
||||
pub fn new(
|
||||
run_type: RunType,
|
||||
sudo: &'a Option<PathBuf>,
|
||||
git: &'a Git,
|
||||
config: &'a Config,
|
||||
base_dirs: &'a BaseDirs,
|
||||
) -> ExecutionContext<'a> {
|
||||
ExecutionContext {
|
||||
run_type,
|
||||
sudo,
|
||||
git,
|
||||
config,
|
||||
base_dirs,
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(unix))]
|
||||
pub fn new(run_type: RunType, config: &'a Config, base_dirs: &'a BaseDirs) -> ExecutionContext<'a> {
|
||||
pub fn new(run_type: RunType, git: &'a Git, config: &'a Config, base_dirs: &'a BaseDirs) -> ExecutionContext<'a> {
|
||||
ExecutionContext {
|
||||
run_type,
|
||||
config,
|
||||
git,
|
||||
base_dirs,
|
||||
}
|
||||
}
|
||||
@@ -42,6 +47,10 @@ impl<'a> ExecutionContext<'a> {
|
||||
self.run_type
|
||||
}
|
||||
|
||||
pub fn git(&self) -> &Git {
|
||||
&self.git
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
pub fn sudo(&self) -> &Option<PathBuf> {
|
||||
&self.sudo
|
||||
|
||||
Reference in New Issue
Block a user