diff options
author | Christian Duerr <contact@christianduerr.com> | 2020-08-22 20:55:27 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-22 20:55:27 +0000 |
commit | 6cfcd7c25930d0478bc35731543e37a2e0c8f13f (patch) | |
tree | c4ded7fbb33774d915d6a25048d8a523cfd57c34 /alacritty/src/main.rs | |
parent | 92a3d482d076eebbd12681444ae8f4dfdf08da69 (diff) | |
download | r-alacritty-6cfcd7c25930d0478bc35731543e37a2e0c8f13f.tar.gz r-alacritty-6cfcd7c25930d0478bc35731543e37a2e0c8f13f.tar.bz2 r-alacritty-6cfcd7c25930d0478bc35731543e37a2e0c8f13f.zip |
Add CLI parameter to override config options
This uses the facilities added in
3c3e6870dedad56b270f5b65ea57d5a6e46b1de6 to allow overriding individual
configuration file options dynamically from the CLI using the
--options/-o parameter.
Fixes #1258.
Diffstat (limited to 'alacritty/src/main.rs')
-rw-r--r-- | alacritty/src/main.rs | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/alacritty/src/main.rs b/alacritty/src/main.rs index 21c4804c..838ce4d2 100644 --- a/alacritty/src/main.rs +++ b/alacritty/src/main.rs @@ -83,12 +83,7 @@ fn main() { .expect("Unable to initialize logger"); // Load configuration file. - let config_path = options.config_path().or_else(config::installed_config); - let config = config_path - .as_ref() - .and_then(|path| config::load_from(path).ok()) - .unwrap_or_else(Config::default); - let config = options.into_config(config); + let config = config::load(&options); // Update the log level from config. log::set_max_level(config.ui_config.debug.log_level); @@ -104,7 +99,7 @@ fn main() { let persistent_logging = config.ui_config.debug.persistent_logging; // Run Alacritty. - if let Err(err) = run(window_event_loop, config) { + if let Err(err) = run(window_event_loop, config, options) { error!("Alacritty encountered an unrecoverable error:\n\n\t{}\n", err); std::process::exit(1); } @@ -121,7 +116,11 @@ fn main() { /// /// Creates a window, the terminal state, PTY, I/O event loop, input processor, /// config change monitor, and runs the main display loop. -fn run(window_event_loop: GlutinEventLoop<Event>, config: Config) -> Result<(), Box<dyn Error>> { +fn run( + window_event_loop: GlutinEventLoop<Event>, + config: Config, + options: Options, +) -> Result<(), Box<dyn Error>> { info!("Welcome to Alacritty"); info!("Configuration files loaded from:"); @@ -189,8 +188,13 @@ fn run(window_event_loop: GlutinEventLoop<Event>, config: Config) -> Result<(), let message_buffer = MessageBuffer::new(); // Event processor. - let mut processor = - Processor::new(event_loop::Notifier(loop_tx.clone()), message_buffer, config, display); + let mut processor = Processor::new( + event_loop::Notifier(loop_tx.clone()), + message_buffer, + config, + display, + options, + ); // Kick off the I/O thread. let io_thread = event_loop.spawn(); |