mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
feat: add --dir option to create command (#1505)
Co-authored-by: sxyazi <sxyazi@gmail.com>
This commit is contained in:
parent
0f106b591c
commit
46f42b2f0c
1 changed files with 3 additions and 2 deletions
|
|
@ -9,11 +9,12 @@ use yazi_shared::{event::Cmd, fs::{maybe_exists, ok_or_not_found, symlink_realpa
|
||||||
use crate::manager::Manager;
|
use crate::manager::Manager;
|
||||||
|
|
||||||
pub struct Opt {
|
pub struct Opt {
|
||||||
|
dir: bool,
|
||||||
force: bool,
|
force: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Cmd> for Opt {
|
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 {
|
impl Manager {
|
||||||
|
|
@ -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
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue