Add --custom-command (#927)

* Add --custom-command
Fixes #922

* fix
This commit is contained in:
Roey Darwish Dror
2022-05-07 15:25:51 +03:00
committed by GitHub
parent fdf03f6548
commit c166d51fb8
3 changed files with 18 additions and 4 deletions

View File

@@ -397,6 +397,10 @@ pub struct CommandLineArgs {
#[clap(long = "only", arg_enum)]
only: Vec<Step>,
/// Run only specific custom commands
#[clap(long = "custom-commands")]
custom_commands: Vec<String>,
/// Set environment variables
#[clap(long = "env")]
env: Vec<String>,
@@ -876,4 +880,12 @@ impl Config {
pub fn display_time(&self) -> bool {
self.config_file.display_time.unwrap_or(true)
}
pub fn should_run_custom_command(&self, name: &str) -> bool {
if self.opt.custom_commands.is_empty() {
return true;
}
self.opt.custom_commands.iter().any(|s| s == name)
}
}