diff options
author | Canop <cano.petrole@gmail.com> | 2020-05-01 14:01:02 +0200 |
---|---|---|
committer | Canop <cano.petrole@gmail.com> | 2020-05-01 21:31:53 +0200 |
commit | 0199162bc8d4fee5bb7f07fbb41570df95205057 (patch) | |
tree | 74c6bb798700b7dc7cc21c0173319f6ee51ba02c /src/launchable.rs | |
parent | cf52bbe7dc19cba78d65f431caa2af36c23da589 (diff) |
command/verb/apply refactoring
* simpler, with immutable commands
* more commands can be triggered by shortcuts
* one can apply verbs to the input (using shortcuts)
Diffstat (limited to 'src/launchable.rs')
-rw-r--r-- | src/launchable.rs | 31 |
1 files changed, 8 insertions, 23 deletions
diff --git a/src/launchable.rs b/src/launchable.rs index ac977e5..95ed2b1 100644 --- a/src/launchable.rs +++ b/src/launchable.rs @@ -1,20 +1,12 @@ use { crate::{ - display::{ - DisplayableTree, - Screen, - }, + display::{DisplayableTree, Screen}, errors::ProgramError, flat_tree::Tree, skin::Skin, }, open, - std::{ - env, - io, - path::PathBuf, - process::Command, - }, + std::{env, io, path::PathBuf, process::Command}, }; /// description of a possible launch of an external program @@ -65,20 +57,14 @@ impl Launchable { pub fn printer(to_print: String) -> Launchable { Launchable::Printer { to_print } } - pub fn tree_printer( - tree: &Tree, - screen: &Screen, - no_style: bool, - ) -> Launchable { + pub fn tree_printer(tree: &Tree, screen: &Screen, no_style: bool) -> Launchable { Launchable::TreePrinter { tree: Box::new(tree.clone()), - skin: Box::new( - if no_style { - Skin::no_term() - } else { - screen.skin.clone() - } - ), + skin: Box::new(if no_style { + Skin::no_term() + } else { + screen.skin.clone() + }), width: screen.width, } } @@ -122,4 +108,3 @@ impl Launchable { } } } - |