added help text

This commit is contained in:
Valerie Wolfe 2024-06-05 10:04:44 -04:00
parent c84e23f95b
commit ee814d261c
2 changed files with 23 additions and 1 deletions

View file

@ -1,6 +1,6 @@
[package]
name = "path-convert"
version = "0.0.2"
version = "0.0.3"
edition = "2021"
[dependencies]

View file

@ -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 <sleeplessval@gmail.com>
Canonicalize and convert Unix paths for DOS programs.
usage: path-convert [flags] <paths...>
args:
<paths...> 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"));
}