summaryrefslogtreecommitdiffstats
path: root/src/commands
diff options
context:
space:
mode:
authorJiayi Zhao <jeff.no.zhao@gmail.com>2020-11-02 12:19:21 -0500
committerJiayi Zhao <jeff.no.zhao@gmail.com>2020-11-02 12:19:21 -0500
commit0cb2c16b4661762efbe3f8263ebb7837657cfb92 (patch)
treecfd70ab8c58d4d154dd8b152ac607c42a5f92eff /src/commands
parent9b6aea79036c40885f352d26e8a2a4892da15306 (diff)
stop using debug print for termion key
- fix certain commands not showing options - fix typos
Diffstat (limited to 'src/commands')
-rw-r--r--src/commands/file_ops.rs4
-rw-r--r--src/commands/key_command.rs25
2 files changed, 18 insertions, 11 deletions
diff --git a/src/commands/file_ops.rs b/src/commands/file_ops.rs
index 5831890..8497d5b 100644
--- a/src/commands/file_ops.rs
+++ b/src/commands/file_ops.rs
@@ -34,9 +34,7 @@ pub fn paste(context: &mut JoshutoContext, options: IOWorkerOptions) -> JoshutoR
match context.take_local_state() {
Some(state) if !state.paths.is_empty() => {
let dest = context.tab_context_ref().curr_tab_ref().pwd().to_path_buf();
- let mut options = options;
- options.kind = state.file_op;
- let worker_thread = IOWorkerThread::new(options, state.paths, dest);
+ let worker_thread = IOWorkerThread::new(state.file_op, state.paths, dest, options);
context.add_worker(worker_thread);
Ok(())
}
diff --git a/src/commands/key_command.rs b/src/commands/key_command.rs
index aceb307..97e655b 100644
--- a/src/commands/key_command.rs
+++ b/src/commands/key_command.rs
@@ -63,7 +63,7 @@ impl KeyCommand {
pub fn command(&self) -> &'static str {
match self {
Self::BulkRename => "bulk_rename",
- Self::ChangeDirectory(_) => "change_directory",
+ Self::ChangeDirectory(_) => "cd",
Self::NewTab => "new_tab",
Self::CloseTab => "close_tab",
Self::CommandLine(_, _) => "console",
@@ -79,7 +79,7 @@ impl KeyCommand {
Self::CursorMovePageUp => "cursor_move_page_up",
Self::CursorMovePageDown => "cursor_move_page_down",
- Self::DeleteFiles => "cursor_move_delete",
+ Self::DeleteFiles => "delete_files",
Self::NewDirectory(_) => "new_directory",
Self::OpenFile => "open",
Self::OpenFileWith => "open_with",
@@ -103,7 +103,7 @@ impl KeyCommand {
Self::ToggleHiddenFiles => "toggle_hidden",
Self::Sort(_) => "sort",
- Self::SortReverse => "sort_reverse",
+ Self::SortReverse => "sort reverse",
Self::TabSwitch(_) => "tab_switch",
}
@@ -248,10 +248,6 @@ impl KeyCommand {
},
},
"tab_switch" => match arg {
- "" => Err(JoshutoError::new(
- JoshutoErrorKind::IOInvalidData,
- format!("{}: {}", command, "No option provided"),
- )),
arg => match arg.parse::<i32>() {
Ok(s) => Ok(Self::TabSwitch(s)),
Err(e) => Err(JoshutoError::new(
@@ -333,7 +329,20 @@ impl JoshutoRunnable for KeyCommand {
impl std::fmt::Display for KeyCommand {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match &*self {
- Self::ChangeDirectory(p) => write!(f, "{} {}", self.command(), p.to_str().unwrap()),
+ Self::ChangeDirectory(p) => write!(f, "{} {:?}", self.command(), p),
+ Self::CommandLine(s, p) => write!(f, "{} {} {}", self.command(), s, p),
+ Self::PasteFiles(options) => write!(f, "{} {}", self.command(), options),
+ Self::CursorMoveUp(i) => write!(f, "{} {}", self.command(), i),
+ Self::CursorMoveDown(i) => write!(f, "{} {}", self.command(), i),
+ Self::NewDirectory(d) => write!(f, "{} {:?}", self.command(), d),
+ Self::RenameFile(name) => write!(f, "{} {:?}", self.command(), name),
+
+ Self::Search(s) => write!(f, "{} {}", self.command(), s),
+ Self::SelectFiles { toggle, all } => write!(f, "{} toggle={} all={}",
+ self.command(), toggle, all),
+ Self::ShellCommand(c) => write!(f, "{} {:?}", self.command(), c),
+ Self::Sort(t) => write!(f, "{} {}", self.command(), t),
+ Self::TabSwitch(i) => write!(f, "{} {}", self.command(), i),
_ => write!(f, "{}", self.command()),
}
}