Conversation

Steven Rostedt

There’s gotta be a better way…

use std::env;
use std::path::Path;

fn usage(arg: &String) {
    let path = Path::new(arg);

    println!("usage: {} a b", path.file_name().unwrap().to_str().unwrap());
}

fn main() {
    let args = env::args();

    if args.len() < 3 {
        usage(&args.collect::<Vec<String>>()[0]);
    }
}
0
0
1