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
- 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

View File

@ -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);

View File

@ -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> ]
\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)