summaryrefslogtreecommitdiffstats
path: root/src/commands
diff options
context:
space:
mode:
authorJiayi Zhao <jeff.no.zhao@gmail.com>2020-04-18 19:10:57 -0400
committerJiayi Zhao <jeff.no.zhao@gmail.com>2020-04-18 19:10:57 -0400
commit3fa40b654a96df76f445da7da3a35bce69730ca8 (patch)
treefa80a7c2b8d622f3adcd5bbb1585ab99d0bccebd /src/commands
parent06b9a79c02717463ed360077a837534b362784b3 (diff)
update to tui-rs 0.9
Diffstat (limited to 'src/commands')
-rw-r--r--src/commands/delete_files.rs2
-rw-r--r--src/commands/new_directory.rs4
-rw-r--r--src/commands/open_file.rs8
-rw-r--r--src/commands/reload_dir.rs2
-rw-r--r--src/commands/rename_file.rs2
-rw-r--r--src/commands/sort.rs6
-rw-r--r--src/commands/tab_operations.rs6
7 files changed, 13 insertions, 17 deletions
diff --git a/src/commands/delete_files.rs b/src/commands/delete_files.rs
index c70cee7..4f1c19a 100644
--- a/src/commands/delete_files.rs
+++ b/src/commands/delete_files.rs
@@ -95,7 +95,7 @@ impl JoshutoRunnable for DeleteFiles {
let options = &context.config_t.sort_option;
let curr_path = context.tabs[context.curr_tab_index].curr_path.clone();
for tab in context.tabs.iter_mut() {
- tab.history.reload(&curr_path, options);
+ tab.history.reload(&curr_path, options)?;
}
LoadChild::load_child(context)?;
Ok(())
diff --git a/src/commands/new_directory.rs b/src/commands/new_directory.rs
index ce27bc9..5152374 100644
--- a/src/commands/new_directory.rs
+++ b/src/commands/new_directory.rs
@@ -1,6 +1,6 @@
use std::path;
-use crate::commands::{JoshutoCommand, JoshutoRunnable, ReloadDirList};
+use crate::commands::{JoshutoCommand, JoshutoRunnable};
use crate::context::JoshutoContext;
use crate::error::JoshutoResult;
use crate::history::DirectoryHistory;
@@ -38,7 +38,7 @@ impl JoshutoRunnable for NewDirectory {
let options = &context.config_t.sort_option;
let curr_path = context.tabs[context.curr_tab_index].curr_path.clone();
for tab in context.tabs.iter_mut() {
- tab.history.reload(&curr_path, options);
+ tab.history.reload(&curr_path, options)?;
}
LoadChild::load_child(context)?;
diff --git a/src/commands/open_file.rs b/src/commands/open_file.rs
index dc2bb13..ca07a11 100644
--- a/src/commands/open_file.rs
+++ b/src/commands/open_file.rs
@@ -1,10 +1,10 @@
-use std::path::{Path, PathBuf};
+use std::path::Path;
use crate::commands::{ChangeDirectory, JoshutoCommand, JoshutoRunnable};
use crate::config::mimetype::JoshutoMimetypeEntry;
use crate::context::JoshutoContext;
use crate::error::{JoshutoError, JoshutoErrorKind, JoshutoResult};
-use crate::fs::{JoshutoDirEntry, JoshutoMetadata};
+use crate::fs::JoshutoDirEntry;
use crate::ui::widgets::{TuiMenu, TuiTextField};
use crate::ui::TuiBackend;
use crate::util::load_child::LoadChild;
@@ -134,12 +134,12 @@ impl OpenFileWith {
.map(|(i, e)| format!(" {} | {}", i, e))
.collect();
let menu_options_str: Vec<&str> = menu_options.iter().map(|e| e.as_str()).collect();
- let mut menu_widget = TuiMenu::new(&menu_options_str);
+ let menu_widget = TuiMenu::new(&menu_options_str);
let mut textfield = TuiTextField::default()
.prompt(":")
.prefix(PROMPT)
- .menu(&mut menu_widget);
+ .menu(menu_widget);
textfield.get_input(backend, &context)
};
let entry_paths: Vec<&Path> = entries.iter().map(|e| e.file_path().as_path()).collect();
diff --git a/src/commands/reload_dir.rs b/src/commands/reload_dir.rs
index 30aa386..0f37eec 100644
--- a/src/commands/reload_dir.rs
+++ b/src/commands/reload_dir.rs
@@ -65,7 +65,7 @@ impl std::fmt::Display for ReloadDirList {
}
impl JoshutoRunnable for ReloadDirList {
- fn execute(&self, context: &mut JoshutoContext, backend: &mut TuiBackend) -> JoshutoResult<()> {
+ fn execute(&self, context: &mut JoshutoContext, _: &mut TuiBackend) -> JoshutoResult<()> {
Self::reload(context.curr_tab_index, context)?;
LoadChild::load_child(context)?;
Ok(())
diff --git a/src/commands/rename_file.rs b/src/commands/rename_file.rs
index a36c86c..f8bb5c6 100644
--- a/src/commands/rename_file.rs
+++ b/src/commands/rename_file.rs
@@ -48,7 +48,7 @@ impl std::fmt::Display for RenameFile {
}
impl JoshutoRunnable for RenameFile {
- fn execute(&self, context: &mut JoshutoContext, backend: &mut TuiBackend) -> JoshutoResult<()> {
+ fn execute(&self, context: &mut JoshutoContext, _: &mut TuiBackend) -> JoshutoResult<()> {
let mut path: Option<path::PathBuf> = None;
if let Some(curr_list) = context.curr_tab_ref().curr_list_ref() {
diff --git a/src/commands/sort.rs b/src/commands/sort.rs
index bbb90c2..7209cb4 100644
--- a/src/commands/sort.rs
+++ b/src/commands/sort.rs
@@ -1,5 +1,3 @@
-use std::path;
-
use crate::commands::{JoshutoCommand, JoshutoRunnable, ReloadDirList};
use crate::context::JoshutoContext;
use crate::error::JoshutoResult;
@@ -9,8 +7,6 @@ use crate::ui::TuiBackend;
use crate::util::load_child::LoadChild;
use crate::util::sort::SortType;
-use crate::HOME_DIR;
-
#[derive(Clone, Debug)]
pub struct Sort {
sort_method: SortType,
@@ -34,7 +30,7 @@ impl std::fmt::Display for Sort {
}
impl JoshutoRunnable for Sort {
- fn execute(&self, context: &mut JoshutoContext, backend: &mut TuiBackend) -> JoshutoResult<()> {
+ fn execute(&self, context: &mut JoshutoContext, _: &mut TuiBackend) -> JoshutoResult<()> {
context.config_t.sort_option.sort_method = self.sort_method;
for tab in context.tabs.iter_mut() {
tab.history.depreciate_all_entries();
diff --git a/src/commands/tab_operations.rs b/src/commands/tab_operations.rs
index 52c03ef..bc3ed9a 100644
--- a/src/commands/tab_operations.rs
+++ b/src/commands/tab_operations.rs
@@ -20,7 +20,7 @@ impl NewTab {
"new_tab"
}
- pub fn new_tab(context: &mut JoshutoContext, backend: &mut TuiBackend) -> JoshutoResult<()> {
+ pub fn new_tab(context: &mut JoshutoContext) -> JoshutoResult<()> {
/* start the new tab in $HOME or root */
let curr_path = match HOME_DIR.as_ref() {
Some(s) => s.clone(),
@@ -45,8 +45,8 @@ impl std::fmt::Display for NewTab {
}
impl JoshutoRunnable for NewTab {
- fn execute(&self, context: &mut JoshutoContext, backend: &mut TuiBackend) -> JoshutoResult<()> {
- Self::new_tab(context, backend)
+ fn execute(&self, context: &mut JoshutoContext, _: &mut TuiBackend) -> JoshutoResult<()> {
+ Self::new_tab(context)
}
}