diff --git a/config/src/boot/boot.rs b/config/src/boot/boot.rs index 574d56ce..87611941 100644 --- a/config/src/boot/boot.rs +++ b/config/src/boot/boot.rs @@ -18,8 +18,13 @@ pub struct Boot { #[command(name = "yazi")] #[command(version = "0.1.3")] struct Args { + // -- TODO: Deprecate this in v0.1.5 /// Set the current working directory #[arg(long, short)] + _cwd: Option, + + /// Set the current working directory + #[arg(index = 1)] cwd: Option, /// Write the cwd on exit to this file @@ -38,8 +43,18 @@ impl Default for Boot { fn default() -> Self { let args = Args::parse(); - let cwd = - args.cwd.map(absolute_path).filter(|p| p.is_dir()).or_else(|| env::current_dir().ok()); + // -- TODO: Deprecate this in v0.1.5 + let cwd = if args._cwd.is_some() { + println!( + "Warning: -c/--cwd is deprecated in v0.1.5, please use the positional argument instead: `yazi --cwd /path/to/dir` -> `yazi /path/to/dir`.\nSee https://github.com/sxyazi/yazi/issues/95 for more information." + ); + args._cwd + } else { + args.cwd + }; + // TODO: Deprecate this in v0.1.5 -- + + let cwd = cwd.map(absolute_path).filter(|p| p.is_dir()).or_else(|| env::current_dir().ok()); let boot = Self { cwd: cwd.unwrap_or("/".into()),