summaryrefslogtreecommitdiffstats
path: root/src/commands/new_directory.rs
diff options
context:
space:
mode:
authorJiayi Zhao <jeff.no.zhao@gmail.com>2020-05-13 09:31:56 -0400
committerJiayi Zhao <jeff.no.zhao@gmail.com>2020-05-13 09:31:56 -0400
commit95bc120687723a8c9e525b7448c5fd71235a329e (patch)
tree84a1e9fe847b366fa1beff8afaa7cba8865bac1c /src/commands/new_directory.rs
parentddb0669bbf0b5bb9e039094e58e69a5a81f13494 (diff)
rework command parsing and add shell command
- This change will break compatibility with previous keymap.toml configs - 'shell' command allows users to run a shell command inside joshuto
Diffstat (limited to 'src/commands/new_directory.rs')
-rw-r--r--src/commands/new_directory.rs10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/commands/new_directory.rs b/src/commands/new_directory.rs
index 5152374..f1ce5e4 100644
--- a/src/commands/new_directory.rs
+++ b/src/commands/new_directory.rs
@@ -9,12 +9,12 @@ use crate::util::load_child::LoadChild;
#[derive(Clone, Debug)]
pub struct NewDirectory {
- paths: Vec<path::PathBuf>,
+ path: path::PathBuf,
}
impl NewDirectory {
- pub fn new(paths: Vec<path::PathBuf>) -> Self {
- NewDirectory { paths }
+ pub fn new(path: path::PathBuf) -> Self {
+ NewDirectory { path }
}
pub const fn command() -> &'static str {
"mkdir"
@@ -31,9 +31,7 @@ impl std::fmt::Display for NewDirectory {
impl JoshutoRunnable for NewDirectory {
fn execute(&self, context: &mut JoshutoContext, _: &mut TuiBackend) -> JoshutoResult<()> {
- for path in &self.paths {
- std::fs::create_dir_all(path)?;
- }
+ std::fs::create_dir_all(&self.path)?;
let options = &context.config_t.sort_option;
let curr_path = context.tabs[context.curr_tab_index].curr_path.clone();