generated from ElnuDev/rust-project
Add non-functional page dimension options to dyesub-cli, implement Error in svg-units
This commit is contained in:
parent
18e507e443
commit
9009ae9e24
8 changed files with 60 additions and 15 deletions
|
@ -9,3 +9,4 @@ edition = "2021"
|
|||
clap = "4.3.23"
|
||||
clap_derive = "4.3.12"
|
||||
dyesub = { path = "../dyesub" }
|
||||
svg-units = { path = "../svg-units" }
|
|
@ -2,7 +2,7 @@ use std::path::PathBuf;
|
|||
|
||||
use clap::Parser;
|
||||
use clap_derive::Parser;
|
||||
use dyesub::Result;
|
||||
use svg_units::SVGMeasure;
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
#[command(author, version, about, long_about = None)]
|
||||
|
@ -12,15 +12,21 @@ struct Args {
|
|||
/// Output SVG path
|
||||
#[arg(short, long)]
|
||||
output: Option<PathBuf>,
|
||||
/// Page width
|
||||
#[arg(long, default_value="11in")]
|
||||
width: SVGMeasure,
|
||||
/// Page height
|
||||
#[arg(long, default_value="8.5in")]
|
||||
height: SVGMeasure,
|
||||
}
|
||||
|
||||
fn main() -> Result<()> {
|
||||
fn main() -> dyesub::Result<()> {
|
||||
let args = Args::parse();
|
||||
let output = args.output.unwrap_or_else(|| {
|
||||
let mut path = args.input.clone();
|
||||
path.set_extension("svg");
|
||||
path
|
||||
});
|
||||
dyesub::render_file(&args.input, output)?;
|
||||
dyesub::render_file(&args.input, &output)?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue