Skip to content

Commit

Permalink
Set --single-package everywhere we can. (#6102)
Browse files Browse the repository at this point in the history
After parsing args the `run_args` can appear in different places in the
struct depending upon how it was invoked. This sets all possible
locations.

The distinction here is:
```
turbo run build --single-package
turbo build --single-package
```

Closes TURBO-1423

Co-authored-by: Nathan Hammond <Nathan Hammond>
  • Loading branch information
nathanhammond committed Oct 5, 2023
1 parent 143299f commit 602e41e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion crates/turborepo-lib/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use anyhow::{anyhow, Result};
use camino::Utf8PathBuf;
use clap::{ArgAction, CommandFactory, Parser, Subcommand, ValueEnum};
use clap_complete::{generate, Shell};
use itertools::Itertools;
use serde::{Deserialize, Serialize};
use tracing::{debug, error};
use turbopath::AbsoluteSystemPathBuf;
Expand Down Expand Up @@ -233,10 +232,16 @@ impl Args {
let mut clap_args = match Args::try_parse_from(single_package_free) {
Ok(mut args) => {
// And then only add them back in when we're in `run`.
// The value can appear in two places in the struct.
// We defensively attempt to set both.
if let Some(ref mut run_args) = args.run_args {
run_args.single_package = is_single_package
}

if let Some(Command::Run(ref mut run_args)) = args.command {
run_args.single_package = is_single_package;
}

args
}
// Don't use error logger when displaying help text
Expand Down

0 comments on commit 602e41e

Please sign in to comment.