Skip to content

Commit

Permalink
Adds a filter shorthand, -F
Browse files Browse the repository at this point in the history
  • Loading branch information
NicholasLYang committed Mar 31, 2023
1 parent 1414a69 commit cae9c8a
Showing 1 changed file with 42 additions and 1 deletion.
43 changes: 42 additions & 1 deletion crates/turborepo-lib/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ pub struct RunArgs {
/// entry points. The syntax mirrors pnpm's syntax, and
/// additional documentation and examples can be found in
/// turbo's documentation https://turbo.build/repo/docs/reference/command-line-reference#--filter
#[clap(long, action = ArgAction::Append)]
#[clap(short = 'F', long, action = ArgAction::Append)]
pub filter: Vec<String>,
/// Ignore the existing cache (to force execution)
#[clap(long)]
Expand Down Expand Up @@ -722,6 +722,47 @@ mod test {
}
);

assert_eq!(
Args::try_parse_from([
"turbo", "run", "build", "-F", "water", "-F", "earth", "-F", "fire", "-F", "air"
])
.unwrap(),
Args {
command: Some(Command::Run(Box::new(RunArgs {
tasks: vec!["build".to_string()],
filter: vec![
"water".to_string(),
"earth".to_string(),
"fire".to_string(),
"air".to_string()
],
..get_default_run_args()
}))),
..Args::default()
}
);

assert_eq!(
Args::try_parse_from([
"turbo", "run", "build", "--filter", "water", "-F", "earth", "--filter", "fire",
"-F", "air"
])
.unwrap(),
Args {
command: Some(Command::Run(Box::new(RunArgs {
tasks: vec!["build".to_string()],
filter: vec![
"water".to_string(),
"earth".to_string(),
"fire".to_string(),
"air".to_string()
],
..get_default_run_args()
}))),
..Args::default()
}
);

assert_eq!(
Args::try_parse_from(["turbo", "run", "build", "--force"]).unwrap(),
Args {
Expand Down

0 comments on commit cae9c8a

Please sign in to comment.