diff --git a/path-convert/Cargo.toml b/path-convert/Cargo.toml index a1dd639..796c545 100644 --- a/path-convert/Cargo.toml +++ b/path-convert/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "path-convert" -version = "0.0.2" +version = "0.0.3" edition = "2021" [dependencies] diff --git a/path-convert/src/main.rs b/path-convert/src/main.rs index ad9b635..4f464f5 100644 --- a/path-convert/src/main.rs +++ b/path-convert/src/main.rs @@ -4,11 +4,18 @@ use pico_args::Arguments; const DRIVE: &str = "/mnt/c/"; +const HELP: [&str;2] = [ "-h", "--help" ]; const QUOTED: [&str;2] = [ "-q", "--quotes" ]; pub fn main() { let mut args = Arguments::from_env(); + // handle help flag + if args.contains(HELP) { + help_text(); + return; + } + // handle quote flag let quotes: &str = if args.contains(QUOTED) { @@ -45,4 +52,19 @@ pub fn main() { } +pub fn help_text() { + println!("path-convert v{} +Valerie Wolfe +Canonicalize and convert Unix paths for DOS programs. + +usage: path-convert [flags] + +args: + one or more paths to convert + +flags: + -h, --help show this help text + -q, --quotes surround the output strings with quotes (-qq for double quotes) +", env!("CARGO_PKG_VERSION")); +}