With the source below:
use gumdrop::Options;
use std::{env, fs, process};
#[derive(Debug, Options)]
struct Args {
#[options(help = "Prints the version", short = "v", long = "version")]
version: bool,
#[options(help = "Calls the list_imports function with a filename", short = "l", long = "list-imports")]
list_imports: Option<String>,
#[options(help = "Updates DLL bindings for <from> so it points to <to>", short = "s", long = "set-import")]
set_import: bool,
#[options(free)]
free_args: Vec<String>,
#[options(help = "Print this help message and exit", short = "h")]
help: bool,
}
fn main() {
let args = Args::parse_args_default_or_exit();
if args.help {
println!("{}", Args::usage());
return;
}
if args.version {
println!("fixPath version 1.0"); // FIXME read from cargo.toml
} else if let Some(filename) = args.list_imports {
println!("{}", filename);
} else if args.set_import {
if args.free_args.len() == 3 {
println!(
"set-import: {}, {}, {}",
args.free_args[0], args.free_args[1], args.free_args[2]
);
} else {
eprintln!("Error: --set-import requires exactly 3 arguments.");
}
} else {
eprintln!("Error: one of --version, --list-imports or --set-import must be provided.");
println!("{}", Args::usage());
process::exit(1);
}
}
why does the text LIST-IMPORTS in call caps appear?!
.\fixPath.exe -h
Usage: C:\Users\joschie\Desktop\Projects\fixPath\target\debug\fixPath.exe [OPTIONS]
Positional arguments:
free_args
Optional arguments:
-v, --version Prints the version
-l, --list-imports LIST-IMPORTS
Prints <file>'s DLL bindings
-s, --set-import Updates <file>'s DLL bindings <from> so it points to <to>
-h, --help Print this help message and exit
https://replit.com/@qknight/gumdrop-example#src/main.rs
With the source below:
why does the text LIST-IMPORTS in call caps appear?!
https://replit.com/@qknight/gumdrop-example#src/main.rs