Skip to content

Commit

Permalink
Add TURBO_CACHE_DIR env for --cache-dir flag (#6294)
Browse files Browse the repository at this point in the history
### Description

Adds the ability to set the `--cache-dir`-flag via an environment
variable named `TURBO_CACHE_DIR`.

### Testing Instructions

TURBO_CACHE_DIR=.turbo-cache turbo run build

---------

Co-authored-by: Chris Olszewski <chris.olszewski@vercel.com>
Co-authored-by: Anthony Shew <anthony.shew@vercel.com>
  • Loading branch information
3 people committed Mar 19, 2024
1 parent 13c20cf commit 8bb58bb
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion crates/turborepo-lib/src/cli/mod.rs
Expand Up @@ -627,7 +627,7 @@ fn path_non_empty(s: &str) -> Result<Utf8PathBuf, String> {
])]
pub struct RunArgs {
/// Override the filesystem cache directory.
#[clap(long, value_parser = path_non_empty)]
#[clap(long, value_parser = path_non_empty, env = "TURBO_CACHE_DIR")]
pub cache_dir: Option<Utf8PathBuf>,
/// Set the number of concurrent cache operations (default 10)
#[clap(long, default_value_t = DEFAULT_NUM_WORKERS)]
Expand Down
2 changes: 1 addition & 1 deletion turborepo-tests/integration/tests/no-args.t
Expand Up @@ -42,7 +42,7 @@ Make sure exit code is 2 when no args are passed

Run Arguments:
--cache-dir <CACHE_DIR>
Override the filesystem cache directory
Override the filesystem cache directory [env: TURBO_CACHE_DIR=]
--cache-workers <CACHE_WORKERS>
Set the number of concurrent cache operations (default 10) [default: 10]
--concurrency <CONCURRENCY>
Expand Down
4 changes: 2 additions & 2 deletions turborepo-tests/integration/tests/turbo-help.t
Expand Up @@ -42,7 +42,7 @@ Test help flag

Run Arguments:
--cache-dir <CACHE_DIR>
Override the filesystem cache directory
Override the filesystem cache directory [env: TURBO_CACHE_DIR=]
--cache-workers <CACHE_WORKERS>
Set the number of concurrent cache operations (default 10) [default: 10]
--concurrency <CONCURRENCY>
Expand Down Expand Up @@ -147,7 +147,7 @@ Test help flag

Run Arguments:
--cache-dir <CACHE_DIR>
Override the filesystem cache directory
Override the filesystem cache directory [env: TURBO_CACHE_DIR=]
--cache-workers <CACHE_WORKERS>
Set the number of concurrent cache operations (default 10) [default: 10]
--concurrency <CONCURRENCY>
Expand Down

0 comments on commit 8bb58bb

Please sign in to comment.