summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCaleb Bassi <calebjbassi@gmail.com>2019-02-15 05:32:05 -0800
committerCaleb Bassi <calebjbassi@gmail.com>2019-02-15 05:32:05 -0800
commit3853eef2d052460982903038daac7abd2b71d12e (patch)
tree58c748d964fe35c74d68ac5a3da87ba842486267
parentf01ae28c15cb099b6d82a0acc7decda0f1807438 (diff)
refactor: rename command to commands
-rw-r--r--src/joshuto.rs6
-rw-r--r--src/joshuto/commands/change_directory.rs (renamed from src/joshuto/command/change_directory.rs)2
-rw-r--r--src/joshuto/commands/cursor_move.rs (renamed from src/joshuto/command/cursor_move.rs)2
-rw-r--r--src/joshuto/commands/delete_files.rs (renamed from src/joshuto/command/delete_files.rs)4
-rw-r--r--src/joshuto/commands/file_operations.rs (renamed from src/joshuto/command/file_operations.rs)4
-rw-r--r--src/joshuto/commands/mod.rs (renamed from src/joshuto/command/mod.rs)0
-rw-r--r--src/joshuto/commands/new_directory.rs (renamed from src/joshuto/command/new_directory.rs)2
-rw-r--r--src/joshuto/commands/open_file.rs (renamed from src/joshuto/command/open_file.rs)6
-rw-r--r--src/joshuto/commands/parent_directory.rs (renamed from src/joshuto/command/parent_directory.rs)2
-rw-r--r--src/joshuto/commands/quit.rs (renamed from src/joshuto/command/quit.rs)2
-rw-r--r--src/joshuto/commands/reload_dir.rs (renamed from src/joshuto/command/reload_dir.rs)2
-rw-r--r--src/joshuto/commands/rename_file.rs (renamed from src/joshuto/command/rename_file.rs)2
-rw-r--r--src/joshuto/commands/search.rs (renamed from src/joshuto/command/search.rs)2
-rw-r--r--src/joshuto/commands/selection.rs (renamed from src/joshuto/command/selection.rs)2
-rw-r--r--src/joshuto/commands/set_mode.rs (renamed from src/joshuto/command/set_mode.rs)2
-rw-r--r--src/joshuto/commands/show_hidden.rs (renamed from src/joshuto/command/show_hidden.rs)2
-rw-r--r--src/joshuto/commands/tab_operations.rs (renamed from src/joshuto/command/tab_operations.rs)2
-rw-r--r--src/joshuto/commands/tab_switch.rs (renamed from src/joshuto/command/tab_switch.rs)2
-rw-r--r--src/joshuto/config/keymap.rs20
-rw-r--r--src/joshuto/context.rs2
20 files changed, 34 insertions, 34 deletions
diff --git a/src/joshuto.rs b/src/joshuto.rs
index 2e97a4e..934a138 100644
--- a/src/joshuto.rs
+++ b/src/joshuto.rs
@@ -2,7 +2,7 @@ extern crate ncurses;
pub mod config;
-mod command;
+mod commands;
mod context;
mod history;
mod preview;
@@ -17,7 +17,7 @@ mod window;
use std::collections::HashMap;
use std::time;
-use self::command::{CommandKeybind, JoshutoCommand};
+use self::commands::{CommandKeybind, JoshutoCommand};
use self::config::{JoshutoMimetype, JoshutoPreview, JoshutoTheme};
use self::context::JoshutoContext;
use self::window::JoshutoPanel;
@@ -168,7 +168,7 @@ pub fn run(config_t: config::JoshutoConfig, keymap_t: config::JoshutoKeymap) {
ui::init_ncurses();
let mut context = context::JoshutoContext::new(config_t);
- command::NewTab::new_tab(&mut context);
+ commands::NewTab::new_tab(&mut context);
ncurses::doupdate();
loop {
diff --git a/src/joshuto/command/change_directory.rs b/src/joshuto/commands/change_directory.rs
index c12aa5e..4565cae 100644
--- a/src/joshuto/command/change_directory.rs
+++ b/src/joshuto/commands/change_directory.rs
@@ -3,7 +3,7 @@ extern crate ncurses;
use std::path;
use std::process;
-use joshuto::command::{JoshutoCommand, JoshutoRunnable};
+use joshuto::commands::{JoshutoCommand, JoshutoRunnable};
use joshuto::context::JoshutoContext;
use joshuto::preview;
use joshuto::ui;
diff --git a/src/joshuto/command/cursor_move.rs b/src/joshuto/commands/cursor_move.rs
index e38e983..8523cf4 100644
--- a/src/joshuto/command/cursor_move.rs
+++ b/src/joshuto/commands/cursor_move.rs
@@ -1,6 +1,6 @@
extern crate ncurses;
-use joshuto::command::{JoshutoCommand, JoshutoRunnable};
+use joshuto::commands::{JoshutoCommand, JoshutoRunnable};
use joshuto::context::JoshutoContext;
use joshuto::preview;
diff --git a/src/joshuto/command/delete_files.rs b/src/joshuto/commands/delete_files.rs
index efd6a05..d71216b 100644
--- a/src/joshuto/command/delete_files.rs
+++ b/src/joshuto/commands/delete_files.rs
@@ -3,7 +3,7 @@ extern crate ncurses;
use std::fs;
use std::path;
-use joshuto::command::{self, JoshutoCommand, JoshutoRunnable};
+use joshuto::commands::{self, JoshutoCommand, JoshutoRunnable};
use joshuto::config::keymap;
use joshuto::context::JoshutoContext;
use joshuto::preview;
@@ -50,7 +50,7 @@ impl JoshutoRunnable for DeleteFiles {
let ch: i32 = ncurses::getch();
if ch == 'y' as i32 || ch == keymap::ENTER as i32 {
if let Some(s) = context.tabs[context.curr_tab_index].curr_list.as_ref() {
- if let Some(paths) = command::collect_selected_paths(s) {
+ if let Some(paths) = commands::collect_selected_paths(s) {
Self::remove_files(paths);
}
}
diff --git a/src/joshuto/command/file_operations.rs b/src/joshuto/commands/file_operations.rs
index f64287e..a3898a3 100644
--- a/src/joshuto/command/file_operations.rs
+++ b/src/joshuto/commands/file_operations.rs
@@ -6,7 +6,7 @@ use std::sync;
use std::thread;
use std::time;
-use joshuto::command::{self, JoshutoCommand, JoshutoRunnable, ProgressInfo};
+use joshuto::commands::{self, JoshutoCommand, JoshutoRunnable, ProgressInfo};
use joshuto::context::JoshutoContext;
use joshuto::preview;
use joshuto::structs::JoshutoDirList;
@@ -44,7 +44,7 @@ fn set_tab_src(tab_index: usize) {
}
fn repopulated_selected_files(dirlist: &JoshutoDirList) -> bool {
- if let Some(contents) = command::collect_selected_paths(dirlist) {
+ if let Some(contents) = commands::collect_selected_paths(dirlist) {
let mut data = selected_files.lock().unwrap();
*data = contents;
return true;
diff --git a/src/joshuto/command/mod.rs b/src/joshuto/commands/mod.rs
index 9451a1d..9451a1d 100644
--- a/src/joshuto/command/mod.rs
+++ b/src/joshuto/commands/mod.rs
diff --git a/src/joshuto/command/new_directory.rs b/src/joshuto/commands/new_directory.rs
index fda2ef7..9095dcb 100644
--- a/src/joshuto/command/new_directory.rs
+++ b/src/joshuto/commands/new_directory.rs
@@ -2,7 +2,7 @@ extern crate ncurses;
use std::path;
-use joshuto::command::{JoshutoCommand, JoshutoRunnable, ReloadDirList};
+use joshuto::commands::{JoshutoCommand, JoshutoRunnable, ReloadDirList};
use joshuto::context::JoshutoContext;
use joshuto::textfield::JoshutoTextField;
use joshuto::ui;
diff --git a/src/joshuto/command/open_file.rs b/src/joshuto/commands/open_file.rs
index 05c6255..3a95bd9 100644
--- a/src/joshuto/command/open_file.rs
+++ b/src/joshuto/commands/open_file.rs
@@ -5,7 +5,7 @@ extern crate open;
use std::env;
use std::path;
-use joshuto::command::{self, JoshutoCommand, JoshutoRunnable};
+use joshuto::commands::{self, JoshutoCommand, JoshutoRunnable};
use joshuto::config::mimetype;
use joshuto::context::JoshutoContext;
use joshuto::preview;
@@ -153,7 +153,7 @@ impl JoshutoRunnable for OpenFile {
} else {
let paths: Option<Vec<path::PathBuf>> =
match context.tabs[context.curr_tab_index].curr_list.as_ref() {
- Some(s) => command::collect_selected_paths(s),
+ Some(s) => commands::collect_selected_paths(s),
None => None,
};
if let Some(paths) = paths {
@@ -258,7 +258,7 @@ impl std::fmt::Display for OpenFileWith {
impl JoshutoRunnable for OpenFileWith {
fn execute(&self, context: &mut JoshutoContext) {
if let Some(s) = context.tabs[context.curr_tab_index].curr_list.as_ref() {
- if let Some(paths) = command::collect_selected_paths(s) {
+ if let Some(paths) = commands::collect_selected_paths(s) {
Self::open_with(&paths);
}
}
diff --git a/src/joshuto/command/parent_directory.rs b/src/joshuto/commands/parent_directory.rs
index ba5ae47..2dd28b9 100644
--- a/src/joshuto/command/parent_directory.rs
+++ b/src/joshuto/commands/parent_directory.rs
@@ -1,6 +1,6 @@
extern crate ncurses;
-use joshuto::command::JoshutoRunnable;
+use joshuto::commands::JoshutoRunnable;
use joshuto::context::JoshutoContext;
use joshuto::preview;
use joshuto::ui;
diff --git a/src/joshuto/command/quit.rs b/src/joshuto/commands/quit.rs
index 48c7b35..d45212e 100644
--- a/src/joshuto/command/quit.rs
+++ b/src/joshuto/commands/quit.rs
@@ -1,6 +1,6 @@
use std::process;
-use joshuto::command::{JoshutoCommand, JoshutoRunnable};
+use joshuto::commands::{JoshutoCommand, JoshutoRunnable};
use joshuto::context::JoshutoContext;
use joshuto::ui;
diff --git a/src/joshuto/command/reload_dir.rs b/src/joshuto/commands/reload_dir.rs
index c7ce161..8948862 100644
--- a/src/joshuto/command/reload_dir.rs
+++ b/src/joshuto/commands/reload_dir.rs
@@ -1,6 +1,6 @@
extern crate ncurses;
-use joshuto::command::{JoshutoCommand, JoshutoRunnable};
+use joshuto::commands::{JoshutoCommand, JoshutoRunnable};
use joshuto::context::JoshutoContext;
use joshuto::preview;
diff --git a/src/joshuto/command/rename_file.rs b/src/joshuto/commands/rename_file.rs
index f974a3e..d298536 100644
--- a/src/joshuto/command/rename_file.rs
+++ b/src/joshuto/commands/rename_file.rs
@@ -3,7 +3,7 @@ extern crate ncurses;
use std::fs;
use std::path;
-use joshuto::command::{JoshutoCommand, JoshutoRunnable};
+use joshuto::commands::{JoshutoCommand, JoshutoRunnable};
use joshuto::context::JoshutoContext;
use joshuto::preview;
use joshuto::textfield::JoshutoTextField;
diff --git a/src/joshuto/command/search.rs b/src/joshuto/commands/search.rs
index cb9fcbc..ac0ba17 100644
--- a/src/joshuto/command/search.rs
+++ b/src/joshuto/commands/search.rs
@@ -1,6 +1,6 @@
extern crate ncurses;
-use joshuto::command::{CursorMove, JoshutoCommand, JoshutoRunnable};
+use joshuto::commands::{CursorMove, JoshutoCommand, JoshutoRunnable};
use joshuto::context::JoshutoContext;
use joshuto::textfield::JoshutoTextField;
use joshuto::ui;
diff --git a/src/joshuto/command/selection.rs b/src/joshuto/commands/selection.rs
index 0d24d43..d5f5d97 100644
--- a/src/joshuto/command/selection.rs
+++ b/src/joshuto/commands/selection.rs
@@ -1,4 +1,4 @@
-use joshuto::command::{CursorMove, JoshutoCommand, JoshutoRunnable};
+use joshuto::commands::{CursorMove, JoshutoCommand, JoshutoRunnable};
use joshuto::context::JoshutoContext;
#[derive(Debug, Clone)]
diff --git a/src/joshuto/command/set_mode.rs b/src/joshuto/commands/set_mode.rs
index 46b4652..4068dd2 100644
--- a/src/joshuto/command/set_mode.rs
+++ b/src/joshuto/commands/set_mode.rs
@@ -1,6 +1,6 @@
extern crate ncurses;
-use joshuto::command::{JoshutoCommand, JoshutoRunnable};
+use joshuto::commands::{JoshutoCommand, JoshutoRunnable};
use joshuto::context::JoshutoContext;
use joshuto::structs::JoshutoDirEntry;
use joshuto::textfield::JoshutoTextField;
diff --git a/src/joshuto/command/show_hidden.rs b/src/joshuto/commands/show_hidden.rs
index 9bbebba..4de6b82 100644
--- a/src/joshuto/command/show_hidden.rs
+++ b/src/joshuto/commands/show_hidden.rs
@@ -1,6 +1,6 @@
extern crate ncurses;
-use joshuto::command::{JoshutoCommand, JoshutoRunnable};
+use joshuto::commands::{JoshutoCommand, JoshutoRunnable};
use joshuto::context::JoshutoContext;
#[derive(Clone, Debug)]
diff --git a/src/joshuto/command/tab_operations.rs b/src/joshuto/commands/tab_operations.rs
index 7bc36f7..74666a8 100644
--- a/src/joshuto/command/tab_operations.rs
+++ b/src/joshuto/commands/tab_operations.rs
@@ -1,7 +1,7 @@
use std::env;
use std::path;
-use joshuto::command::{JoshutoCommand, JoshutoRunnable, TabSwitch};
+use joshuto::commands::{JoshutoCommand, JoshutoRunnable, TabSwitch};
use joshuto::context::JoshutoContext;
use joshuto::tab::JoshutoTab;
use joshuto::ui;
diff --git a/src/joshuto/command/tab_switch.rs b/src/joshuto/commands/tab_switch.rs
index 66800fa..67e2ad3 100644
--- a/src/joshuto/command/tab_switch.rs
+++ b/src/joshuto/commands/tab_switch.rs
@@ -1,4 +1,4 @@
-use joshuto::command::{JoshutoCommand, JoshutoRunnable};
+use joshuto::commands::{JoshutoCommand, JoshutoRunnable};
use joshuto::context::JoshutoContext;
use joshuto::ui;
diff --git a/src/joshuto/config/keymap.rs b/src/joshuto/config/keymap.rs
index a6642e7..dcb963d 100644
--- a/src/joshuto/config/keymap.rs
+++ b/src/joshuto/config/keymap.rs
@@ -5,7 +5,7 @@ extern crate xdg;
use std::collections::HashMap;
use std::process::exit;
-use joshuto::command;
+use joshuto::commands;
use joshuto::config::{parse_config_file, Flattenable};
use KEYMAP_FILE;
@@ -30,10 +30,10 @@ struct JoshutoRawKeymap {
impl Flattenable<JoshutoKeymap> for JoshutoRawKeymap {
fn flatten(self) -> JoshutoKeymap {
- let mut keymaps: HashMap<i32, command::CommandKeybind> = HashMap::new();
+ let mut keymaps: HashMap<i32, commands::CommandKeybind> = HashMap::new();
if let Some(maps) = self.mapcommand {
for mapcommand in maps {
- match command::from_args(mapcommand.command.as_str(), mapcommand.args.as_ref()) {
+ match commands::from_args(mapcommand.command.as_str(), mapcommand.args.as_ref()) {
Some(command) => {
insert_keycommand(&mut keymaps, command, &mapcommand.keys[..]);
}
@@ -49,7 +49,7 @@ impl Flattenable<JoshutoKeymap> for JoshutoRawKeymap {
#[derive(Debug)]
pub struct JoshutoKeymap {
- pub keymaps: HashMap<i32, command::CommandKeybind>,
+ pub keymaps: HashMap<i32, commands::CommandKeybind>,
}
impl JoshutoKeymap {
@@ -65,23 +65,23 @@ impl JoshutoKeymap {
}
fn insert_keycommand(
- map: &mut HashMap<i32, command::CommandKeybind>,
- keycommand: Box<dyn command::JoshutoCommand>,
+ map: &mut HashMap<i32, commands::CommandKeybind>,
+ keycommand: Box<dyn commands::JoshutoCommand>,
keys: &[String],
) {
if keys.len() == 1 {
match key_to_i32(&keys[0]) {
Some(s) => {
- map.insert(s, command::CommandKeybind::SimpleKeybind(keycommand));
+ map.insert(s, commands::CommandKeybind::SimpleKeybind(keycommand));
}
None => {}
}
} else {
match key_to_i32(&keys[0]) {
Some(s) => {
- let mut new_map: HashMap<i32, command::CommandKeybind>;
+ let mut new_map: HashMap<i32, commands::CommandKeybind>;
match map.remove(&s) {
- Some(command::CommandKeybind::CompositeKeybind(mut m)) => {
+ Some(commands::CommandKeybind::CompositeKeybind(mut m)) => {
new_map = m;
}
Some(_) => {
@@ -93,7 +93,7 @@ fn insert_keycommand(
}
}
insert_keycommand(&mut new_map, keycommand, &keys[1..]);
- let composite_command = command::CommandKeybind::CompositeKeybind(new_map);
+ let composite_command = commands::CommandKeybind::CompositeKeybind(new_map);
map.insert(s as i32, composite_command);
}
None => {}
diff --git a/src/joshuto/context.rs b/src/joshuto/context.rs
index f9218ff..2dc41f1 100644
--- a/src/joshuto/context.rs
+++ b/src/joshuto/context.rs
@@ -1,4 +1,4 @@
-use joshuto::command::FileOperationThread;
+use joshuto::commands::FileOperationThread;
use joshuto::config;
use joshuto::tab::JoshutoTab;
use joshuto::window::JoshutoView;