Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add --dir option to create command #1505

Merged
merged 3 commits into from
Aug 20, 2024
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
5 changes: 3 additions & 2 deletions yazi-core/src/manager/commands/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ use yazi_shared::{event::Cmd, fs::{maybe_exists, ok_or_not_found, symlink_realpa
use crate::manager::Manager;

pub struct Opt {
dir: bool,
force: bool,
}

impl From<Cmd> for Opt {
fn from(c: Cmd) -> Self { Self { force: c.bool("force") } }
fn from(c: Cmd) -> Self { Self { dir: c.bool("dir"), force: c.bool("force") } }
}

impl Manager {
Expand All @@ -37,7 +38,7 @@ impl Manager {
}
}

Self::create_do(new, name.ends_with('/') || name.ends_with('\\')).await
Self::create_do(new, opt.dir || name.ends_with('/') || name.ends_with('\\')).await
});
}

Expand Down