From 07684281901b8d287221ade9b7c93a0f437a26f1 Mon Sep 17 00:00:00 2001 From: Christian Duerr Date: Wed, 25 Nov 2020 22:49:19 +0000 Subject: [PATCH] Remove redundant CLI flags This removes some of Alacritty's CLI flags since the same functionality is provided by the '--option' flag now. The removed flags are: * '--persistent-logging' * '--live-config-reload' * '--no-live-config-reload' * '--dimensions' * '--position' Fixes #4246. --- CHANGELOG.md | 9 ++++ alacritty/src/cli.rs | 84 +------------------------------ alacritty/src/config/ui_config.rs | 5 -- alacritty/src/config/window.rs | 5 -- extra/alacritty.man | 15 ------ 5 files changed, 10 insertions(+), 108 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 799af26f..bce81fe1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,15 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Wide characters sometimes being cut off - Preserve vi mode across terminal `reset` +### Removed + +- The following CLI arguments have been removed in favor of the `--option` flag: + * `--persistent-logging` + * `--live-config-reload` + * `--no-live-config-reload` + * `--dimensions` + * `--position` + ## 0.6.0 ### Packaging diff --git a/alacritty/src/cli.rs b/alacritty/src/cli.rs index 6303d081..cacffcdc 100644 --- a/alacritty/src/cli.rs +++ b/alacritty/src/cli.rs @@ -6,11 +6,9 @@ use log::{self, error, LevelFilter}; use serde_yaml::Value; use alacritty_terminal::config::Program; -use alacritty_terminal::index::{Column, Line}; use crate::config::serde_utils; -use crate::config::ui_config::Delta; -use crate::config::window::{Dimensions, DEFAULT_NAME}; +use crate::config::window::DEFAULT_NAME; use crate::config::Config; #[cfg(not(any(target_os = "macos", windows)))] @@ -22,11 +20,8 @@ const CONFIG_PATH: &str = "$HOME/.config/alacritty/alacritty.yml"; /// Options specified on the command line. pub struct Options { - pub live_config_reload: Option, pub print_events: bool, pub ref_test: bool, - pub dimensions: Option, - pub position: Option>, pub title: Option, pub class_instance: Option, pub class_general: Option, @@ -36,18 +31,14 @@ pub struct Options { pub hold: bool, pub working_directory: Option, pub config_path: Option, - pub persistent_logging: bool, pub config_options: Value, } impl Default for Options { fn default() -> Options { Options { - live_config_reload: None, print_events: false, ref_test: false, - dimensions: None, - position: None, title: None, class_instance: None, class_general: None, @@ -57,7 +48,6 @@ impl Default for Options { hold: false, working_directory: None, config_path: None, - persistent_logging: false, config_options: Value::Null, } } @@ -79,47 +69,11 @@ impl Options { .author(crate_authors!("\n")) .about(crate_description!()) .arg(Arg::with_name("ref-test").long("ref-test").help("Generates ref test")) - .arg( - Arg::with_name("live-config-reload") - .long("live-config-reload") - .help("Enable automatic config reloading"), - ) - .arg( - Arg::with_name("no-live-config-reload") - .long("no-live-config-reload") - .help("Disable automatic config reloading") - .conflicts_with("live-config-reload"), - ) .arg( Arg::with_name("print-events") .long("print-events") .help("Print all events to stdout"), ) - .arg( - Arg::with_name("persistent-logging") - .long("persistent-logging") - .help("Keep the log file after quitting Alacritty"), - ) - .arg( - Arg::with_name("dimensions") - .long("dimensions") - .short("d") - .value_names(&["columns", "lines"]) - .help( - "Defines the window dimensions. Falls back to size specified by window \ - manager if set to 0x0 [default: 0x0]", - ), - ) - .arg( - Arg::with_name("position") - .long("position") - .allow_hyphen_values(true) - .value_names(&["x-pos", "y-pos"]) - .help( - "Defines the window position. Falls back to position specified by window \ - manager if unset [default: unset]", - ), - ) .arg( Arg::with_name("title") .long("title") @@ -194,32 +148,6 @@ impl Options { options.print_events = true; } - if matches.is_present("live-config-reload") { - options.live_config_reload = Some(true); - } else if matches.is_present("no-live-config-reload") { - options.live_config_reload = Some(false); - } - - if matches.is_present("persistent-logging") { - options.persistent_logging = true; - } - - if let Some(mut dimensions) = matches.values_of("dimensions") { - let columns = dimensions.next().map(|columns| columns.parse().map(Column)); - let lines = dimensions.next().map(|lines| lines.parse().map(Line)); - if let (Some(Ok(columns)), Some(Ok(lines))) = (columns, lines) { - options.dimensions = Some(Dimensions { columns, lines }); - } - } - - if let Some(mut position) = matches.values_of("position") { - let x = position.next().map(str::parse); - let y = position.next().map(str::parse); - if let (Some(Ok(x)), Some(Ok(y))) = (x, y) { - options.position = Some(Delta { x, y }); - } - } - if let Some(mut class) = matches.values_of("class") { options.class_instance = class.next().map(|instance| instance.to_owned()); options.class_general = class.next().map(|general| general.to_owned()); @@ -296,10 +224,6 @@ impl Options { } } - if let Some(lcr) = self.live_config_reload { - config.ui_config.set_live_config_reload(lcr); - } - if let Some(command) = &self.command { config.shell = Some(command.clone()); } @@ -309,20 +233,14 @@ impl Options { let dynamic_title = config.ui_config.dynamic_title() && self.title.is_none(); config.ui_config.set_dynamic_title(dynamic_title); - if let Some(dimensions) = self.dimensions { - config.ui_config.window.set_dimensions(dimensions); - } - replace_if_some(&mut config.ui_config.window.title, self.title.clone()); replace_if_some(&mut config.ui_config.window.class.instance, self.class_instance.clone()); replace_if_some(&mut config.ui_config.window.class.general, self.class_general.clone()); - config.ui_config.window.position = self.position.or(config.ui_config.window.position); config.ui_config.window.embed = self.embed.as_ref().and_then(|embed| embed.parse().ok()); config.ui_config.debug.print_events |= self.print_events; config.ui_config.debug.log_level = max(config.ui_config.debug.log_level, self.log_level); config.ui_config.debug.ref_test |= self.ref_test; - config.ui_config.debug.persistent_logging |= self.persistent_logging; if config.ui_config.debug.print_events { config.ui_config.debug.log_level = diff --git a/alacritty/src/config/ui_config.rs b/alacritty/src/config/ui_config.rs index 31654c6c..87b27b3e 100644 --- a/alacritty/src/config/ui_config.rs +++ b/alacritty/src/config/ui_config.rs @@ -97,11 +97,6 @@ impl UIConfig { self.live_config_reload.0 } - #[inline] - pub fn set_live_config_reload(&mut self, live_config_reload: bool) { - self.live_config_reload.0 = live_config_reload; - } - /// Send escape sequences using the alt key. #[inline] pub fn alt_send_esc(&self) -> bool { diff --git a/alacritty/src/config/window.rs b/alacritty/src/config/window.rs index 17c9de5c..ce36d23c 100644 --- a/alacritty/src/config/window.rs +++ b/alacritty/src/config/window.rs @@ -76,11 +76,6 @@ impl WindowConfig { self.dynamic_title.0 = dynamic_title; } - #[inline] - pub fn set_dimensions(&mut self, dimensions: Dimensions) { - self.dimensions = dimensions; - } - #[inline] pub fn dimensions(&self) -> Option { if self.dimensions.columns.0 != 0 diff --git a/extra/alacritty.man b/extra/alacritty.man index 9d31dcf6..e620ea65 100644 --- a/extra/alacritty.man +++ b/extra/alacritty.man @@ -17,15 +17,6 @@ Prints help information \fB\-\-hold\fR Remain open after child process exits .TP -\fB\-\-live\-config\-reload\fR -Enable automatic config reloading -.TP -\fB\-\-no\-live\-config\-reload\fR -Disable automatic config reloading -.TP -\fB\-\-persistent\-logging\fR -Keep the log file after quitting Alacritty -.TP \fB\-\-print\-events\fR Print all events to stdout .TP @@ -61,18 +52,12 @@ Alacritty looks for the configuration file at the following paths: On Windows, the configuration file is located at %APPDATA%\\alacritty\\alacritty.yml. .TP -\fB\-d\fR, \fB\-\-dimensions\fR -Defines the window dimensions. Falls back to size specified by window manager if set to 0x0 [default: 0x0] -.TP \fB\-\-embed\fR Defines the X11 window ID (as a decimal integer) to embed Alacritty within .TP \fB\-o\fR, \fB\-\-option\fR