Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions cmdapp/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,30 @@ pub fn config_from_args() -> (PathBuf, PathBuf, Config) {
.long("input")
.short("i")
.takes_value(true)
.required_unless("posinput")
.help("Path to input raster image")
.required(true),
);

let app = app.arg(
Arg::with_name("output")
.long("output")
.short("o")
.takes_value(true)
.required_unless("posoutput")
.help("Path to output vector graphics")
.required(true),
);

let app = app.arg(
Arg::with_name("posinput")
.index(1)
.required_unless("input")
);
let app = app.arg(
Arg::with_name("posoutput")
.index(2)
.required_unless("output")
);

let app = app.arg(
Arg::with_name("color_mode")
.long("colormode")
Expand Down Expand Up @@ -130,9 +141,11 @@ pub fn config_from_args() -> (PathBuf, PathBuf, Config) {
let mut config = Config::default();
let input_path = matches
.value_of("input")
.or_else(|| matches.value_of("posinput"))
.expect("Input path is required, please specify it by --input or -i.");
let output_path = matches
.value_of("output")
.or_else(|| matches.value_of("posoutput"))
.expect("Output path is required, please specify it by --output or -o.");

let input_path = PathBuf::from(input_path);
Expand Down