diff options
author | Minh-Tam Tran <tran.minhtam.tenshi@gmail.com> | 2020-04-28 17:12:40 +0200 |
---|---|---|
committer | Minh-Tam Tran <tran.minhtam.tenshi@gmail.com> | 2020-04-28 17:15:46 +0200 |
commit | 094f03c8536122844e7385d7d83f5d5997910164 (patch) | |
tree | e2c7d9df4cb66110b2143a52b79f081417ec18a9 /svgbob_cli | |
parent | 86d2f7d529fcd6f99b198cedc7a35aa73b1cc39e (diff) |
Add --background and --fill-color to cli options
Diffstat (limited to 'svgbob_cli')
-rw-r--r-- | svgbob_cli/src/main.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/svgbob_cli/src/main.rs b/svgbob_cli/src/main.rs index c92d233..d86c2f8 100644 --- a/svgbob_cli/src/main.rs +++ b/svgbob_cli/src/main.rs @@ -20,6 +20,10 @@ fn main() { let args = App::new("svgbob") .version(crate_version!()) .about("SvgBobRus is an ascii to svg converter") + .arg(Arg::with_name("background") + .long("background") + .takes_value(true) + .help("backdrop background will be filled with this color (default: 'white')")) .arg(Arg::with_name("inline").short("s").help("parse an inline string")) .arg(Arg::with_name("input").index(1).help("svgbob text file or inline string to parse [default: STDIN]")) .arg(Arg::with_name("output") @@ -27,6 +31,10 @@ fn main() { .long("output") .takes_value(true) .help("where to write svg output [default: STDOUT]")) + .arg(Arg::with_name("fill-color") + .long("fill-color") + .takes_value(true) + .help("solid shapes will be filled with this color (default: 'black')")) .arg(Arg::with_name("font-family") .long("font-family") .takes_value(true) @@ -101,6 +109,14 @@ fn main() { let mut settings = Settings::default(); + if let Some(background) = args.value_of("background") { + settings.background = background.to_string(); + } + + if let Some(fill_color) = args.value_of("fill-color") { + settings.fill_color = fill_color.to_string(); + } + if let Some(font_family) = args.value_of("font-family") { settings.font_family = font_family.to_string(); } |