Skip to content

Commit

Permalink
feat: add --out-dir flag to generate-css
Browse files Browse the repository at this point in the history
  • Loading branch information
Gankra committed Feb 23, 2024
1 parent b75d40a commit 6817e6f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -114,5 +114,5 @@ artifacts = ["oranda-config-schema.json"]
build = ["cargo", "run", "--", "config-schema", "--output=oranda-config-schema.json"]

[[workspace.metadata.dist.extra-artifacts]]
artifacts = ["oranda-css/dist/oranda.css"]
build = ["cargo", "run", "--", "generate-css"]
artifacts = ["oranda.css"]
build = ["cargo", "run", "--", "generate-css", "--out-dir=./"]
11 changes: 8 additions & 3 deletions src/commands/print.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use axoasset::LocalAsset;
use camino::Utf8PathBuf;
use clap::Parser;
use oranda::errors::*;
use oranda_generate_css::default_css_output_dir;
Expand Down Expand Up @@ -27,13 +28,17 @@ impl ConfigSchema {
}

#[derive(Debug, Parser)]
pub struct GenerateCss {}
pub struct GenerateCss {
#[clap(long)]
out_dir: Option<Utf8PathBuf>,
}

impl GenerateCss {
pub fn run(&self) -> Result<()> {
let out_dir = default_css_output_dir();
let out_dir = self.out_dir.clone().unwrap_or_else(default_css_output_dir);
let out_file = out_dir.join("oranda.css");
oranda_generate_css::build_css(&out_dir)?;
tracing::info!("CSS placed in {out_dir}/oranda.css");
tracing::info!("CSS placed in {out_file}");
Ok(())
}
}

0 comments on commit 6817e6f

Please sign in to comment.