Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions config/src/boot/boot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<PathBuf>,

/// Set the current working directory
#[arg(index = 1)]
cwd: Option<PathBuf>,

/// Write the cwd on exit to this file
Expand All @@ -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()),
Expand Down