diff options
author | Jiayi Zhao <jeff.no.zhao@gmail.com> | 2019-08-06 19:29:13 -0400 |
---|---|---|
committer | Jiayi Zhao <jeff.no.zhao@gmail.com> | 2019-08-06 19:29:13 -0400 |
commit | 681062585815f218195d1dd6393022b651d7f751 (patch) | |
tree | 37fa31a085fe1e0e197c54245bd71096663ce801 /src/commands | |
parent | 0d8005d9e3994acbd4251a6ba67643d9a1bf2bb1 (diff) | |
parent | e0bbe7f3890ee66acfc83357720c9bfabf782c39 (diff) |
Merge branch 'dev' of github.com:kamiyaa/joshuto into dev
Diffstat (limited to 'src/commands')
-rw-r--r-- | src/commands/mod.rs | 12 | ||||
-rw-r--r-- | src/commands/open_file.rs | 4 |
2 files changed, 8 insertions, 8 deletions
diff --git a/src/commands/mod.rs b/src/commands/mod.rs index d94e1a0..ad60802 100644 --- a/src/commands/mod.rs +++ b/src/commands/mod.rs @@ -55,12 +55,6 @@ pub enum CommandKeybind { CompositeKeybind(JoshutoCommandMapping), } -pub trait JoshutoRunnable { - fn execute(&self, context: &mut JoshutoContext, view: &JoshutoView) -> JoshutoResult<()>; -} - -pub trait JoshutoCommand: JoshutoRunnable + std::fmt::Display + std::fmt::Debug {} - impl std::fmt::Display for CommandKeybind { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { match self { @@ -70,6 +64,12 @@ impl std::fmt::Display for CommandKeybind { } } +pub trait JoshutoRunnable { + fn execute(&self, context: &mut JoshutoContext, view: &JoshutoView) -> JoshutoResult<()>; +} + +pub trait JoshutoCommand: JoshutoRunnable + std::fmt::Display + std::fmt::Debug {} + pub fn from_args(command: String, args: Vec<String>) -> JoshutoResult<Box<JoshutoCommand>> { match command.as_str() { "bulk_rename" => Ok(Box::new(self::BulkRename::new())), diff --git a/src/commands/open_file.rs b/src/commands/open_file.rs index 78637fb..6651e3c 100644 --- a/src/commands/open_file.rs +++ b/src/commands/open_file.rs @@ -70,7 +70,7 @@ impl OpenFile { /* try executing with user defined entries */ if !mimetype_options.is_empty() { - mimetype_options[0].execute_with(&paths); + mimetype_options[0].execute_with(&paths)?; } else if context.config_t.xdg_open { // try system defined entries ncurses::savetty(); ncurses::endwin(); @@ -78,7 +78,7 @@ impl OpenFile { ncurses::resetty(); ncurses::refresh(); } else { // ask user for command - OpenFileWith::open_with(&paths); + OpenFileWith::open_with(&paths)?; } let curr_tab = &mut context.tabs[context.curr_tab_index]; if curr_tab.curr_list.need_update() { |