From eb8b155329b2c2689cc5b854f0b87f4448485c66 Mon Sep 17 00:00:00 2001 From: Jeff Zhao Date: Sat, 16 Jul 2022 22:54:34 -0400 Subject: move --path option to default option --- src/main.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/main.rs b/src/main.rs index f7795a6..c1f47ab 100644 --- a/src/main.rs +++ b/src/main.rs @@ -77,12 +77,12 @@ lazy_static! { #[derive(Clone, Debug, StructOpt)] pub struct Args { - #[structopt(long = "path", parse(from_os_str))] - path: Option, #[structopt(short = "v", long = "version")] version: bool, #[structopt(long = "output-file", parse(from_os_str))] output_file: Option, + #[structopt(name = "ARGUMENTS")] + rest: Vec, } fn run_joshuto(args: Args) -> Result { @@ -91,7 +91,8 @@ fn run_joshuto(args: Args) -> Result { println!("{}-{}", PROGRAM_NAME, version); return Ok(0); } - if let Some(p) = args.path.as_ref() { + if !args.rest.is_empty() { + let p = PathBuf::from(args.rest[0].as_str()); if let Err(e) = std::env::set_current_dir(p.as_path()) { eprintln!("{}", e); process::exit(1); -- cgit v1.2.3