diff options
author | Jeff Zhao <jeff.no.zhao@gmail.com> | 2022-07-16 22:54:34 -0400 |
---|---|---|
committer | Jeff Zhao <jeff.no.zhao@gmail.com> | 2022-07-16 22:54:34 -0400 |
commit | eb8b155329b2c2689cc5b854f0b87f4448485c66 (patch) | |
tree | 594ec40cc8efc1176a5dcaac3a0d90ee5594433b /src/main.rs | |
parent | 6d230ce96e668c168a5393ef3294623986d547fc (diff) |
move --path option to default option
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 7 |
1 files changed, 4 insertions, 3 deletions
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<PathBuf>, #[structopt(short = "v", long = "version")] version: bool, #[structopt(long = "output-file", parse(from_os_str))] output_file: Option<PathBuf>, + #[structopt(name = "ARGUMENTS")] + rest: Vec<String>, } fn run_joshuto(args: Args) -> Result<i32, JoshutoError> { @@ -91,7 +91,8 @@ fn run_joshuto(args: Args) -> Result<i32, JoshutoError> { 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); |