diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/commands/mod.rs | 2 | ||||
-rw-r--r-- | src/commands/select.rs (renamed from src/commands/selection.rs) | 0 | ||||
-rw-r--r-- | src/config/keymap/keymapping.rs | 2 | ||||
-rw-r--r-- | src/key_command/impl_appexecute.rs | 2 | ||||
-rw-r--r-- | src/main.rs | 14 | ||||
-rw-r--r-- | src/run.rs | 2 |
6 files changed, 14 insertions, 8 deletions
diff --git a/src/commands/mod.rs b/src/commands/mod.rs index f4e0ee5..4f270ea 100644 --- a/src/commands/mod.rs +++ b/src/commands/mod.rs @@ -18,7 +18,7 @@ pub mod search; pub mod search_fzf; pub mod search_glob; pub mod search_string; -pub mod selection; +pub mod select; pub mod set_mode; pub mod show_help; pub mod show_hidden; diff --git a/src/commands/selection.rs b/src/commands/select.rs index a4d26c4..a4d26c4 100644 --- a/src/commands/selection.rs +++ b/src/commands/select.rs diff --git a/src/config/keymap/keymapping.rs b/src/config/keymap/keymapping.rs index cc30f04..dedbb39 100644 --- a/src/config/keymap/keymapping.rs +++ b/src/config/keymap/keymapping.rs @@ -92,7 +92,7 @@ fn vec_to_map(vec: &[CommandKeymap]) -> HashMap<Event, CommandKeybind> { }, } } - Err(e) => eprintln!("{}", e), + Err(e) => eprintln!("Keymap error: {}", e), } } hashmap diff --git a/src/key_command/impl_appexecute.rs b/src/key_command/impl_appexecute.rs index cd7aacc..bf8dbab 100644 --- a/src/key_command/impl_appexecute.rs +++ b/src/key_command/impl_appexecute.rs @@ -88,7 +88,7 @@ impl AppExecute for Command { Self::SearchPrev => search::search_prev(context), Self::SelectFiles(pattern, options) => { - selection::select_files(context, pattern.as_str(), options) + select::select_files(context, pattern.as_str(), options) } Self::SetMode => set_mode::set_mode(context, backend), Self::ShowTasks => show_tasks::show_tasks(context, backend, keymap_t), diff --git a/src/main.rs b/src/main.rs index 26f1d59..2b3f171 100644 --- a/src/main.rs +++ b/src/main.rs @@ -27,7 +27,6 @@ use crate::config::{ }; use crate::context::AppContext; use crate::error::JoshutoError; -use crate::run::run; const PROGRAM_NAME: &str = "joshuto"; const CONFIG_HOME: &str = "JOSHUTO_CONFIG_HOME"; @@ -88,7 +87,7 @@ pub struct Args { rest: Vec<String>, } -fn run_joshuto(args: Args) -> Result<i32, JoshutoError> { +fn run_main(args: Args) -> Result<i32, JoshutoError> { if args.version { let version = env!("CARGO_PKG_VERSION"); println!("{}-{}", PROGRAM_NAME, version); @@ -102,13 +101,20 @@ fn run_joshuto(args: Args) -> Result<i32, JoshutoError> { } } + // make sure all configs have been loaded before starting let config = AppConfig::get_config(CONFIG_FILE); let keymap = AppKeyMapping::get_config(KEYMAP_FILE); + lazy_static::initialize(&THEME_T); + lazy_static::initialize(&MIMETYPE_T); + lazy_static::initialize(&PREVIEW_T); + lazy_static::initialize(&HOME_DIR); + lazy_static::initialize(&USERNAME); + lazy_static::initialize(&HOSTNAME); let mut context = AppContext::new(config, args.clone()); { let mut backend: ui::AppBackend = ui::AppBackend::new()?; - run(&mut backend, &mut context, keymap)?; + run::run_loop(&mut backend, &mut context, keymap)?; } run_quit(&args, &context)?; Ok(context.quit.exit_code()) @@ -169,7 +175,7 @@ fn run_quit(args: &Args, context: &AppContext) -> Result<(), JoshutoError> { fn main() { let args = Args::from_args(); - match run_joshuto(args) { + match run_main(args) { Ok(exit_code) => process::exit(exit_code), Err(e) => { eprintln!("{}", e); @@ -15,7 +15,7 @@ use crate::ui::views::TuiView; use termion::event::{Event, Key}; use tui::layout::Rect; -pub fn run( +pub fn run_loop( backend: &mut ui::AppBackend, context: &mut AppContext, keymap_t: AppKeyMapping, |