committed by
GitHub
parent
84c3a0f4d1
commit
8e7fd6772d
@@ -396,6 +396,10 @@ pub struct CommandLineArgs {
|
||||
#[clap(long = "only", arg_enum)]
|
||||
only: Vec<Step>,
|
||||
|
||||
/// Set environment variables
|
||||
#[clap(long = "env")]
|
||||
env: Vec<String>,
|
||||
|
||||
/// Output logs
|
||||
#[clap(short = 'v', long = "verbose")]
|
||||
pub verbose: bool,
|
||||
@@ -433,6 +437,10 @@ impl CommandLineArgs {
|
||||
pub fn show_config_reference(&self) -> bool {
|
||||
self.show_config_reference
|
||||
}
|
||||
|
||||
pub fn env_variables(&self) -> &Vec<String> {
|
||||
&self.env
|
||||
}
|
||||
}
|
||||
|
||||
/// Represents the application configuration
|
||||
|
||||
@@ -39,6 +39,14 @@ fn run() -> Result<()> {
|
||||
let base_dirs = directories::BaseDirs::new().ok_or_else(|| anyhow!("No base directories"))?;
|
||||
|
||||
let opt = CommandLineArgs::parse();
|
||||
|
||||
for env in opt.env_variables() {
|
||||
let mut splitted = env.split('=');
|
||||
let var = splitted.next().unwrap();
|
||||
let value = splitted.next().unwrap();
|
||||
env::set_var(var, value);
|
||||
}
|
||||
|
||||
let mut builder = formatted_timed_builder();
|
||||
|
||||
if opt.verbose {
|
||||
|
||||
Reference in New Issue
Block a user