diff options
author | Jovansonlee Cesar <ivanceras@gmail.com> | 2020-05-09 19:34:01 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-09 19:34:01 +0800 |
commit | e6257539df03a1f46c44e76066423e24dc7c8738 (patch) | |
tree | 5a5e80877e2df26f7af0de793e5f1345890b7765 | |
parent | b74f5c5d011c3d831684211092569c35bf673df3 (diff) | |
parent | 094f03c8536122844e7385d7d83f5d5997910164 (diff) |
Merge pull request #54 from Melandel/master
Add --background and --fill-color to cli options
-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(); } |