diff options
author | Jeff Zhao <jeff.no.zhao@gmail.com> | 2021-04-29 23:51:26 -0400 |
---|---|---|
committer | Jeff Zhao <jeff.no.zhao@gmail.com> | 2021-04-29 23:59:22 -0400 |
commit | 49758f09f45b39845ede9626fe0ca4f3eedf6698 (patch) | |
tree | 685618e2f6056a5b2abb9e973b75c2eaf7a9496d /src/main.rs | |
parent | 32a40e37c16f867d76642fd791eb996a37ef3f6b (diff) |
rename some structs that start with Joshuto to App
- reduce sharing global variables between modules
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/main.rs b/src/main.rs index b0d6445..282d291 100644 --- a/src/main.rs +++ b/src/main.rs @@ -18,10 +18,9 @@ use std::process; use structopt::StructOpt; use crate::config::{ - ConfigStructure, JoshutoConfig, JoshutoKeyMapping, JoshutoMimetype, JoshutoPreview, - JoshutoTheme, + AppConfig, AppKeyMapping, AppMimetypeRegistry, AppTheme, ConfigStructure, JoshutoPreview, }; -use crate::context::JoshutoContext; +use crate::context::AppContext; use crate::error::{JoshutoError, JoshutoErrorKind}; use crate::run::run; @@ -46,9 +45,9 @@ lazy_static! { } temp }; - static ref THEME_T: JoshutoTheme = JoshutoTheme::get_config(); - static ref MIMETYPE_T: JoshutoMimetype = JoshutoMimetype::get_config(); - static ref PREVIEW_T: JoshutoPreview = JoshutoPreview::get_config(); + static ref THEME_T: AppTheme = AppTheme::get_config(THEME_FILE); + static ref MIMETYPE_T: AppMimetypeRegistry = AppMimetypeRegistry::get_config(MIMETYPE_FILE); + static ref PREVIEW_T: JoshutoPreview = JoshutoPreview::get_config(PREVIEW_FILE); static ref HOME_DIR: Option<PathBuf> = dirs_next::home_dir(); static ref USERNAME: String = whoami::username(); @@ -85,10 +84,10 @@ fn run_joshuto(args: Args) -> Result<(), JoshutoError> { } } - let config = JoshutoConfig::get_config(); - let keymap = JoshutoKeyMapping::get_config(); + let config = AppConfig::get_config(CONFIG_FILE); + let keymap = AppKeyMapping::get_config(KEYMAP_FILE); - let mut context = JoshutoContext::new(config); + let mut context = AppContext::new(config); { let mut backend: ui::TuiBackend = ui::TuiBackend::new()?; |