Skip to content

Commit 1d850bb

Browse files
authored
Merge pull request #82 from gladstone-9/default_flags
FSRT=1 by default
2 parents d6d10a5 + 38d92a0 commit 1d850bb

1 file changed

Lines changed: 20 additions & 4 deletions

File tree

crates/fsrt/src/main.rs

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ pub struct Args {
8282
#[arg(long)]
8383
graphql_schema_path: Option<PathBuf>,
8484

85-
/// If true, use cached permissions; otherwise, re-download and reparse Swagger files.
86-
#[arg(long)]
87-
cached_permissions: bool,
85+
/// If true, disable cached permissions and re-download and reparse Swagger files.
86+
#[arg(long, default_value_t = false)]
87+
no_cache: bool,
8888

8989
/// Path to store or load cached permissions. If not provided, defaults to `~/.cache/fsrt`.
9090
#[arg(long)]
@@ -445,7 +445,23 @@ pub(crate) fn scan_directory<'a>(
445445
.collect::<Vec<_>>();
446446

447447
let config = CacheConfig::new(
448-
opts.cached_permissions || std::env::var_os("FSRT_CACHE").is_some_and(|s| !s.is_empty()),
448+
if opts.no_cache {
449+
false
450+
} else {
451+
match std::env::var("FSRT_CACHE") {
452+
Err(_) => true,
453+
Ok(s) => {
454+
let t = s.trim();
455+
match t {
456+
"0" => false,
457+
t if t.eq_ignore_ascii_case("false") => false,
458+
"" | "1" => true,
459+
t if t.eq_ignore_ascii_case("true") => true,
460+
_ => true,
461+
}
462+
}
463+
}
464+
},
449465
opts.cached_permissions_path.clone(),
450466
);
451467

0 commit comments

Comments
 (0)