diff options
author | Christian Duerr <contact@christianduerr.com> | 2021-08-18 09:36:51 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-18 09:36:51 +0000 |
commit | 62a1fad524ebdf0592bb37aed76c2caac29a7f47 (patch) | |
tree | 0dbd9f7994324a94b4b587243c8a6e9e48e4747a /alacritty/src/config/mod.rs | |
parent | abed2e97488f57d37743f090c16c12eff812b2ce (diff) | |
download | r-alacritty-62a1fad524ebdf0592bb37aed76c2caac29a7f47.tar.gz r-alacritty-62a1fad524ebdf0592bb37aed76c2caac29a7f47.tar.bz2 r-alacritty-62a1fad524ebdf0592bb37aed76c2caac29a7f47.zip |
Migrate CLI config to structopt
While structopt also uses clap under the hood, the configuration through
annotations allows for significantly more maintainable and concise CLI
definition.
This will also make it far easier to have platform-specific options,
which is problematic with clap since no individual methods can be
removed from its builder.
The change in Alacritty's CLI has been kept to a minimum with the only
significant changes being the `--version` flag listed before the
`-v` flag and the authors all on the same line.
Diffstat (limited to 'alacritty/src/config/mod.rs')
-rw-r--r-- | alacritty/src/config/mod.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/alacritty/src/config/mod.rs b/alacritty/src/config/mod.rs index 43cade6d..4a3c0ae9 100644 --- a/alacritty/src/config/mod.rs +++ b/alacritty/src/config/mod.rs @@ -101,8 +101,8 @@ impl From<serde_yaml::Error> for Error { /// Load the configuration file. pub fn load(options: &Options) -> Config { - let config_options = options.config_options().clone(); - let config_path = options.config_path().or_else(installed_config); + let config_options = options.config_options.clone(); + let config_path = options.config_file.clone().or_else(installed_config); // Load the config using the following fallback behavior: // - Config path + CLI overrides @@ -128,7 +128,7 @@ pub fn load(options: &Options) -> Config { /// Attempt to reload the configuration file. pub fn reload(config_path: &Path, options: &Options) -> Result<Config> { // Load config, propagating errors. - let config_options = options.config_options().clone(); + let config_options = options.config_options.clone(); let mut config = load_from(config_path, config_options)?; after_loading(&mut config, options); |