1
0
Fork 0
mirror of https://github.com/alacritty/alacritty.git synced 2024-11-11 13:51:01 -05:00

Update --help for class option to match manpage

This commit is contained in:
Jeff Windsor 2020-07-03 23:13:32 -07:00 committed by GitHub
parent 09179d06fd
commit e1474a1e5f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 13 deletions

View file

@ -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 - Scroll down escape (`CSI Ps T`) incorrectly pulling lines from history
- Dim escape (`CSI 2 m`) support for truecolor text - Dim escape (`CSI 2 m`) support for truecolor text
- Incorrectly deleted lines when increasing width with a prompt wrapped using spaces - 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 ## 0.4.3

View file

@ -24,7 +24,8 @@ pub struct Options {
pub dimensions: Option<Dimensions>, pub dimensions: Option<Dimensions>,
pub position: Option<Delta<i32>>, pub position: Option<Delta<i32>>,
pub title: Option<String>, pub title: Option<String>,
pub class: Option<String>, pub class_instance: Option<String>,
pub class_general: Option<String>,
pub embed: Option<String>, pub embed: Option<String>,
pub log_level: LevelFilter, pub log_level: LevelFilter,
pub command: Option<Program>, pub command: Option<Program>,
@ -43,7 +44,8 @@ impl Default for Options {
dimensions: None, dimensions: None,
position: None, position: None,
title: None, title: None,
class: None, class_instance: None,
class_general: None,
embed: None, embed: None,
log_level: LevelFilter::Warn, log_level: LevelFilter::Warn,
command: None, command: None,
@ -122,8 +124,13 @@ impl Options {
.arg( .arg(
Arg::with_name("class") Arg::with_name("class")
.long("class") .long("class")
.value_name("instance> | <instance>,<general")
.takes_value(true) .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(
Arg::with_name("embed").long("embed").takes_value(true).help( 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.title = matches.value_of("title").map(ToOwned::to_owned);
options.embed = matches.value_of("embed").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.position = self.position.or(config.window.position);
config.window.embed = self.embed.and_then(|embed| embed.parse().ok()); config.window.embed = self.embed.and_then(|embed| embed.parse().ok());
if let Some(class) = self.class { config.window.class.instance = self.class_instance.unwrap_or(config.window.class.instance);
let parts: Vec<_> = class.split(',').collect(); config.window.class.general = self.class_general.unwrap_or(config.window.class.general);
config.window.class.instance = parts[0].into();
if let Some(&general) = parts.get(1) {
config.window.class.general = general.into();
}
}
config.debug.print_events = self.print_events || config.debug.print_events; config.debug.print_events = self.print_events || config.debug.print_events;
config.debug.log_level = max(config.debug.log_level, self.log_level); config.debug.log_level = max(config.debug.log_level, self.log_level);

View file

@ -42,8 +42,10 @@ Increases the level of verbosity (the max level is \fB\-vvv\fR)
Prints version information Prints version information
.SH "OPTIONS" .SH "OPTIONS"
.TP .TP
\fB\-\-class\fR [ <instance> | <instance>,<general> ] \fB\-\-class\fR <instance> | <instance>,<general>
Defines the window class hint on Linux [default: Alacritty,Alacritty ] 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 .TP
\fB\-e\fR, \fB\-\-command\fR <command>... \fB\-e\fR, \fB\-\-command\fR <command>...
Command and args to execute (must be last argument) Command and args to execute (must be last argument)