diff options
author | Jeff Windsor <jeff.windsor@gmail.com> | 2020-07-03 23:13:32 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-04 09:13:32 +0300 |
commit | e1474a1e5fe866e0444f9a97ede69bbe9b1f3b44 (patch) | |
tree | 2bdb0f0c63b5d30b646e683d297c602a53c7810a | |
parent | 09179d06fd07c13deb0b108a6f9264f77d9d9599 (diff) | |
download | alacritty-e1474a1e5fe866e0444f9a97ede69bbe9b1f3b44.tar.gz alacritty-e1474a1e5fe866e0444f9a97ede69bbe9b1f3b44.zip |
Update --help for class option to match manpage
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | alacritty/src/cli.rs | 28 | ||||
-rw-r--r-- | extra/alacritty.man | 6 |
3 files changed, 22 insertions, 13 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 8109b100..ccf6cd07 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -53,6 +53,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Scroll down escape (`CSI Ps T`) incorrectly pulling lines from history - Dim escape (`CSI 2 m`) support for truecolor text - Incorrectly deleted lines when increasing width with a prompt wrapped using spaces +- Documentation for class in `--help` missing information on setting general class ## 0.4.3 diff --git a/alacritty/src/cli.rs b/alacritty/src/cli.rs index 3e592577..89db20e1 100644 --- a/alacritty/src/cli.rs +++ b/alacritty/src/cli.rs @@ -24,7 +24,8 @@ pub struct Options { pub dimensions: Option<Dimensions>, pub position: Option<Delta<i32>>, pub title: Option<String>, - pub class: Option<String>, + pub class_instance: Option<String>, + pub class_general: Option<String>, pub embed: Option<String>, pub log_level: LevelFilter, pub command: Option<Program>, @@ -43,7 +44,8 @@ impl Default for Options { dimensions: None, position: None, title: None, - class: None, + class_instance: None, + class_general: None, embed: None, log_level: LevelFilter::Warn, command: None, @@ -122,8 +124,13 @@ impl Options { .arg( Arg::with_name("class") .long("class") + .value_name("instance> | <instance>,<general") .takes_value(true) - .help(&format!("Defines window class on Linux [default: {}]", DEFAULT_NAME)), + .use_delimiter(true) + .help(&format!( + "Defines window class or `app_id` on Linux [default: {}]", + DEFAULT_NAME + )), ) .arg( Arg::with_name("embed").long("embed").takes_value(true).help( @@ -200,7 +207,11 @@ impl Options { } } - options.class = matches.value_of("class").map(ToOwned::to_owned); + 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()); + } + options.title = matches.value_of("title").map(ToOwned::to_owned); options.embed = matches.value_of("embed").map(ToOwned::to_owned); @@ -264,13 +275,8 @@ impl Options { config.window.position = self.position.or(config.window.position); config.window.embed = self.embed.and_then(|embed| embed.parse().ok()); - if let Some(class) = self.class { - let parts: Vec<_> = class.split(',').collect(); - config.window.class.instance = parts[0].into(); - if let Some(&general) = parts.get(1) { - config.window.class.general = general.into(); - } - } + config.window.class.instance = self.class_instance.unwrap_or(config.window.class.instance); + config.window.class.general = self.class_general.unwrap_or(config.window.class.general); config.debug.print_events = self.print_events || config.debug.print_events; config.debug.log_level = max(config.debug.log_level, self.log_level); diff --git a/extra/alacritty.man b/extra/alacritty.man index 9d56a78b..9d90def4 100644 --- a/extra/alacritty.man +++ b/extra/alacritty.man @@ -42,8 +42,10 @@ Increases the level of verbosity (the max level is \fB\-vvv\fR) Prints version information .SH "OPTIONS" .TP -\fB\-\-class\fR [ <instance> | <instance>,<general> ] -Defines the window class hint on Linux [default: Alacritty,Alacritty ] +\fB\-\-class\fR <instance> | <instance>,<general> +Defines the window class hint on Linux [default: Alacritty,Alacritty] + +On Wayland the instance class sets the `app_id`, while the general class is ignored. .TP \fB\-e\fR, \fB\-\-command\fR <command>... Command and args to execute (must be last argument) |