mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
Add --dir option to 'create' command
This allows you to bind 'create --dir' to a key, to create directories without having to remember to put / or \ at the end.
This commit is contained in:
parent
99a3b3a043
commit
d57444d336
1 changed files with 9 additions and 3 deletions
|
|
@ -4,16 +4,22 @@ use anyhow::Result;
|
|||
use tokio::fs;
|
||||
use yazi_config::popup::InputCfg;
|
||||
use yazi_proxy::{InputProxy, TabProxy, WATCHER};
|
||||
use yazi_shared::{event::Cmd, fs::{maybe_exists, ok_or_not_found, symlink_realpath, File, FilesOp, Url}};
|
||||
use yazi_shared::{
|
||||
event::Cmd,
|
||||
fs::{maybe_exists, ok_or_not_found, symlink_realpath, File, FilesOp, Url},
|
||||
};
|
||||
|
||||
use crate::manager::Manager;
|
||||
|
||||
pub struct Opt {
|
||||
force: bool,
|
||||
dir: bool,
|
||||
}
|
||||
|
||||
impl From<Cmd> for Opt {
|
||||
fn from(c: Cmd) -> Self { Self { force: c.bool("force") } }
|
||||
fn from(c: Cmd) -> Self {
|
||||
Self { force: c.bool("force"), dir: c.bool("dir") }
|
||||
}
|
||||
}
|
||||
|
||||
impl Manager {
|
||||
|
|
@ -37,7 +43,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
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue