committed by
GitHub
parent
fdf03f6548
commit
c166d51fb8
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@@ -32,7 +32,7 @@
|
|||||||
{
|
{
|
||||||
"type": "promptString",
|
"type": "promptString",
|
||||||
"id": "step",
|
"id": "step",
|
||||||
"description": "step nname",
|
"description": "step name",
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -397,6 +397,10 @@ pub struct CommandLineArgs {
|
|||||||
#[clap(long = "only", arg_enum)]
|
#[clap(long = "only", arg_enum)]
|
||||||
only: Vec<Step>,
|
only: Vec<Step>,
|
||||||
|
|
||||||
|
/// Run only specific custom commands
|
||||||
|
#[clap(long = "custom-commands")]
|
||||||
|
custom_commands: Vec<String>,
|
||||||
|
|
||||||
/// Set environment variables
|
/// Set environment variables
|
||||||
#[clap(long = "env")]
|
#[clap(long = "env")]
|
||||||
env: Vec<String>,
|
env: Vec<String>,
|
||||||
@@ -876,4 +880,12 @@ impl Config {
|
|||||||
pub fn display_time(&self) -> bool {
|
pub fn display_time(&self) -> bool {
|
||||||
self.config_file.display_time.unwrap_or(true)
|
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)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -360,9 +360,11 @@ fn run() -> Result<()> {
|
|||||||
|
|
||||||
if let Some(commands) = config.commands() {
|
if let Some(commands) = config.commands() {
|
||||||
for (name, command) in commands {
|
for (name, command) in commands {
|
||||||
runner.execute(Step::CustomCommands, name, || {
|
if config.should_run_custom_command(name) {
|
||||||
generic::run_custom_command(name, command, &ctx)
|
runner.execute(Step::CustomCommands, name, || {
|
||||||
})?;
|
generic::run_custom_command(name, command, &ctx)
|
||||||
|
})?;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user