diff options
author | rabite0 <rabite@posteo.de> | 2019-04-27 19:11:51 +0200 |
---|---|---|
committer | rabite <rabite@posteo.de> | 2019-04-27 19:12:33 +0200 |
commit | eb913f39acbef08e967d05c1701d468e776a0674 (patch) | |
tree | bc62986032679d895685d5518b0680d11e3fb5a4 /src/config.rs | |
parent | 80854f6c3a390b65bc54e9450bf8e805115dc1d4 (diff) |
Select files and enter directories by calling external program (#27)
* select file/dir with external program
* multi-file select with external prog
* last adjustions and README update
* separated cd/selection into their own functions
* update README
Diffstat (limited to 'src/config.rs')
-rw-r--r-- | src/config.rs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/config.rs b/src/config.rs index 4801286..5b0f8dc 100644 --- a/src/config.rs +++ b/src/config.rs @@ -5,6 +5,8 @@ use crate::fail::{HError, HResult, ErrorLog}; pub struct Config { pub animation: bool, pub show_hidden: bool, + pub select_cmd: String, + pub cd_cmd: String } @@ -12,7 +14,9 @@ impl Config { pub fn new() -> Config { Config { animation: true, - show_hidden: false + show_hidden: false, + select_cmd: "find -type f | fzf -m".to_string(), + cd_cmd: "find -type d | fzf".to_string() } } @@ -31,6 +35,14 @@ impl Config { Ok(("animation", "off")) => { config.animation = false; }, Ok(("show_hidden", "on")) => { config.show_hidden = true; }, Ok(("show_hidden", "off")) => { config.show_hidden = false; }, + Ok(("select_cmd", cmd)) => { + let cmd = cmd.to_string(); + config.select_cmd = cmd; + } + Ok(("cd_cmd", cmd)) => { + let cmd = cmd.to_string(); + config.cd_cmd = cmd; + } _ => { HError::config_error::<Config>(line.to_string()).log(); } } config |