summaryrefslogtreecommitdiffstats
path: root/src/key_command/traits.rs
diff options
context:
space:
mode:
authorJeff Zhao <jeff.no.zhao@gmail.com>2021-10-02 17:24:16 -0400
committerJeff Zhao <jeff.no.zhao@gmail.com>2021-10-02 17:24:54 -0400
commit65006271ed71fc79ef7d4582b5a676029bf3f65b (patch)
tree9b4b4f552f8eebb4c161ef936762095efaac721c /src/key_command/traits.rs
parent8b5c257adfc8177cc4413309c0d1fc98d854ac1d (diff)
move key_command code out into separate module
- make separate files for trait impls - make separate file for constants
Diffstat (limited to 'src/key_command/traits.rs')
-rw-r--r--src/key_command/traits.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/key_command/traits.rs b/src/key_command/traits.rs
new file mode 100644
index 0000000..c96fb2b
--- /dev/null
+++ b/src/key_command/traits.rs
@@ -0,0 +1,17 @@
+use crate::config::AppKeyMapping;
+use crate::context::AppContext;
+use crate::error::JoshutoResult;
+use crate::ui::TuiBackend;
+
+pub trait AppExecute {
+ fn execute(
+ &self,
+ context: &mut AppContext,
+ backend: &mut TuiBackend,
+ keymap_t: &AppKeyMapping,
+ ) -> JoshutoResult<()>;
+}
+
+pub trait AppCommand: AppExecute + std::fmt::Display + std::fmt::Debug {
+ fn command(&self) -> &'static str;
+}