Skip to content

Commit

Permalink
Check for --render before cache operations
Browse files Browse the repository at this point in the history
  • Loading branch information
acuteenvy committed Nov 22, 2023
1 parent fed5ad2 commit 6e5b35d
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ fn run() -> Result<()> {
init_color(cli.color);

let mut config = Config::new(cli.config)?;
config.output.compact = !cli.no_compact && (cli.compact || config.output.compact);
config.output.raw_markdown = !cli.no_raw && (cli.raw || config.output.raw_markdown);

if let Some(path) = cli.render {
return PageRenderer::print(&path, &config);
}

let languages_are_from_cli = cli.languages.is_some();
let mut languages = cli.languages.unwrap_or_else(|| get_languages(&mut config));
let languages_to_download = if languages_are_from_cli {
Expand All @@ -71,12 +78,6 @@ fn run() -> Result<()> {
return cache.update(&languages_to_download);
}

config.output.compact = !cli.no_compact && (cli.compact || config.output.compact);
config.output.raw_markdown = !cli.no_raw && (cli.raw || config.output.raw_markdown);
if let Some(path) = cli.render {
return PageRenderer::print(&path, &config);
}

if !cache.english_dir_exists() {
infoln!("cache is empty, downloading...");
cache.update(&languages_to_download)?;
Expand Down

0 comments on commit 6e5b35d

Please sign in to comment.