1
0
Fork 0
mirror of https://github.com/alacritty/alacritty.git synced 2025-06-30 19:22:55 -04:00

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.
This commit is contained in:
Christian Duerr 2020-11-25 22:49:19 +00:00 committed by GitHub
parent 26479bb9f5
commit 0768428190
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 108 deletions

View file

@ -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 - Wide characters sometimes being cut off
- Preserve vi mode across terminal `reset` - 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 ## 0.6.0
### Packaging ### Packaging

View file

@ -6,11 +6,9 @@ use log::{self, error, LevelFilter};
use serde_yaml::Value; use serde_yaml::Value;
use alacritty_terminal::config::Program; use alacritty_terminal::config::Program;
use alacritty_terminal::index::{Column, Line};
use crate::config::serde_utils; use crate::config::serde_utils;
use crate::config::ui_config::Delta; use crate::config::window::DEFAULT_NAME;
use crate::config::window::{Dimensions, DEFAULT_NAME};
use crate::config::Config; use crate::config::Config;
#[cfg(not(any(target_os = "macos", windows)))] #[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. /// Options specified on the command line.
pub struct Options { pub struct Options {
pub live_config_reload: Option<bool>,
pub print_events: bool, pub print_events: bool,
pub ref_test: bool, pub ref_test: bool,
pub dimensions: Option<Dimensions>,
pub position: Option<Delta<i32>>,
pub title: Option<String>, pub title: Option<String>,
pub class_instance: Option<String>, pub class_instance: Option<String>,
pub class_general: Option<String>, pub class_general: Option<String>,
@ -36,18 +31,14 @@ pub struct Options {
pub hold: bool, pub hold: bool,
pub working_directory: Option<PathBuf>, pub working_directory: Option<PathBuf>,
pub config_path: Option<PathBuf>, pub config_path: Option<PathBuf>,
pub persistent_logging: bool,
pub config_options: Value, pub config_options: Value,
} }
impl Default for Options { impl Default for Options {
fn default() -> Options { fn default() -> Options {
Options { Options {
live_config_reload: None,
print_events: false, print_events: false,
ref_test: false, ref_test: false,
dimensions: None,
position: None,
title: None, title: None,
class_instance: None, class_instance: None,
class_general: None, class_general: None,
@ -57,7 +48,6 @@ impl Default for Options {
hold: false, hold: false,
working_directory: None, working_directory: None,
config_path: None, config_path: None,
persistent_logging: false,
config_options: Value::Null, config_options: Value::Null,
} }
} }
@ -79,47 +69,11 @@ impl Options {
.author(crate_authors!("\n")) .author(crate_authors!("\n"))
.about(crate_description!()) .about(crate_description!())
.arg(Arg::with_name("ref-test").long("ref-test").help("Generates ref test")) .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(
Arg::with_name("print-events") Arg::with_name("print-events")
.long("print-events") .long("print-events")
.help("Print all events to stdout"), .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(
Arg::with_name("title") Arg::with_name("title")
.long("title") .long("title")
@ -194,32 +148,6 @@ impl Options {
options.print_events = true; 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") { if let Some(mut class) = matches.values_of("class") {
options.class_instance = class.next().map(|instance| instance.to_owned()); options.class_instance = class.next().map(|instance| instance.to_owned());
options.class_general = class.next().map(|general| general.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 { if let Some(command) = &self.command {
config.shell = Some(command.clone()); config.shell = Some(command.clone());
} }
@ -309,20 +233,14 @@ impl Options {
let dynamic_title = config.ui_config.dynamic_title() && self.title.is_none(); let dynamic_title = config.ui_config.dynamic_title() && self.title.is_none();
config.ui_config.set_dynamic_title(dynamic_title); 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.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.instance, self.class_instance.clone());
replace_if_some(&mut config.ui_config.window.class.general, self.class_general.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.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.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.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.ref_test |= self.ref_test;
config.ui_config.debug.persistent_logging |= self.persistent_logging;
if config.ui_config.debug.print_events { if config.ui_config.debug.print_events {
config.ui_config.debug.log_level = config.ui_config.debug.log_level =

View file

@ -97,11 +97,6 @@ impl UIConfig {
self.live_config_reload.0 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. /// Send escape sequences using the alt key.
#[inline] #[inline]
pub fn alt_send_esc(&self) -> bool { pub fn alt_send_esc(&self) -> bool {

View file

@ -76,11 +76,6 @@ impl WindowConfig {
self.dynamic_title.0 = dynamic_title; self.dynamic_title.0 = dynamic_title;
} }
#[inline]
pub fn set_dimensions(&mut self, dimensions: Dimensions) {
self.dimensions = dimensions;
}
#[inline] #[inline]
pub fn dimensions(&self) -> Option<Dimensions> { pub fn dimensions(&self) -> Option<Dimensions> {
if self.dimensions.columns.0 != 0 if self.dimensions.columns.0 != 0

View file

@ -17,15 +17,6 @@ Prints help information
\fB\-\-hold\fR \fB\-\-hold\fR
Remain open after child process exits Remain open after child process exits
.TP .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 \fB\-\-print\-events\fR
Print all events to stdout Print all events to stdout
.TP .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. On Windows, the configuration file is located at %APPDATA%\\alacritty\\alacritty.yml.
.TP .TP
\fB\-d\fR, \fB\-\-dimensions\fR <columns> <lines>
Defines the window dimensions. Falls back to size specified by window manager if set to 0x0 [default: 0x0]
.TP
\fB\-\-embed\fR <parent> \fB\-\-embed\fR <parent>
Defines the X11 window ID (as a decimal integer) to embed Alacritty within Defines the X11 window ID (as a decimal integer) to embed Alacritty within
.TP .TP
\fB\-o\fR, \fB\-\-option\fR <option>... \fB\-o\fR, \fB\-\-option\fR <option>...
Override configuration file options [example: cursor.style=Beam] Override configuration file options [example: cursor.style=Beam]
.TP .TP
\fB\-\-position\fR <x-pos> <y-pos>
Defines the window position. Falls back to position specified by window manager if unset [default: unset]
.TP
\fB\-t\fR, \fB\-\-title\fR <title> \fB\-t\fR, \fB\-\-title\fR <title>
Defines the window title [default: Alacritty] Defines the window title [default: Alacritty]
.TP .TP