Skip to content

Commit

Permalink
fix(start): rename to start with multi occurence of single task
Browse files Browse the repository at this point in the history
  • Loading branch information
Joxit committed Apr 16, 2021
1 parent 23f4a6d commit 85fbaa0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/commands/mod.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
use crate::commands::completion::Completion;
use crate::commands::dot::Dot;
use crate::commands::exec::Exec;
use crate::commands::run::Run;
use crate::commands::completion::Completion;
use structopt::StructOpt;

mod completion;
mod dot;
mod exec;
mod run;
mod completion;

#[derive(Debug, StructOpt)]
pub enum Command {
Expand Down
14 changes: 3 additions & 11 deletions src/commands/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ pub struct Run {
/// Override the starting task if the job had already been started before.
/// When using many configuration files, start states must be in the first configuration file.
/// Can be many task ids with comma separated values.
#[structopt(long = "starts", short = "s")]
starts: Option<String>,
#[structopt(long = "start", short = "s", number_of_values = 1)]
starts: Vec<String>,
/// Run the task in background
#[structopt(long = "background", short = "b")]
background: bool,
Expand All @@ -40,16 +40,8 @@ impl Run {
unsafe { signal(SIGHUP, SIG_IGN) };
}

let starts: Vec<String> = if let Some(starts) = &self.starts {
starts
.split(",")
.map(|s| s.to_string())
.collect::<Vec<String>>()
} else {
vec![]
};
for (i, config) in self.config.iter().enumerate() {
let starts = if i == 0 { starts.clone() } else { vec![] };
let starts = if i == 0 { self.starts.clone() } else { vec![] };
if let Err(e) = self.run(&config.as_path(), &starts) {
eprintln!("{}", e);
exit(1);
Expand Down

0 comments on commit 85fbaa0

Please sign in to comment.