diff options
author | Nathan Lilienthal <nathan@nixpulvis.com> | 2018-06-18 01:26:54 -0400 |
---|---|---|
committer | Christian Duerr <chrisduerr@users.noreply.github.com> | 2018-06-18 05:26:54 +0000 |
commit | f55252ec8537e68d0c98a1fac35728a2b596d328 (patch) | |
tree | 8a9f879ad803faec66d9a9b4385e4dcd8f358680 /src/cli.rs | |
parent | 5ba34d4f9766a55a06ed5e3e44cc384af1b09f65 (diff) | |
download | alacritty-f55252ec8537e68d0c98a1fac35728a2b596d328.tar.gz alacritty-f55252ec8537e68d0c98a1fac35728a2b596d328.zip |
Override dynamic_title when --title is specified
Diffstat (limited to 'src/cli.rs')
-rw-r--r-- | src/cli.rs | 24 |
1 files changed, 8 insertions, 16 deletions
@@ -18,17 +18,14 @@ use config::{Dimensions, Shell}; use std::path::{Path, PathBuf}; use std::borrow::Cow; -const DEFAULT_TITLE: &str = "Alacritty"; -const DEFAULT_CLASS: &str = "Alacritty"; - /// Options specified on the command line pub struct Options { pub live_config_reload: Option<bool>, pub print_events: bool, pub ref_test: bool, pub dimensions: Option<Dimensions>, - pub title: String, - pub class: String, + pub title: Option<String>, + pub class: Option<String>, pub log_level: log::LevelFilter, pub command: Option<Shell<'static>>, pub working_dir: Option<PathBuf>, @@ -42,8 +39,8 @@ impl Default for Options { print_events: false, ref_test: false, dimensions: None, - title: DEFAULT_TITLE.to_owned(), - class: DEFAULT_CLASS.to_owned(), + title: None, + class: None, log_level: log::LevelFilter::Warn, command: None, working_dir: None, @@ -82,11 +79,11 @@ impl Options { .arg(Arg::with_name("title") .long("title") .short("t") - .default_value(DEFAULT_TITLE) + .takes_value(true) .help("Defines the window title")) .arg(Arg::with_name("class") .long("class") - .default_value(DEFAULT_CLASS) + .takes_value(true) .help("Defines window class on X11")) .arg(Arg::with_name("q") .short("q") @@ -139,13 +136,8 @@ impl Options { } } - if let Some(title) = matches.value_of("title") { - options.title = title.to_owned(); - } - - if let Some(class) = matches.value_of("class") { - options.class = class.to_owned(); - } + options.class = matches.value_of("class").map(|c| c.to_owned()); + options.title = matches.value_of("title").map(|t| t.to_owned()); match matches.occurrences_of("q") { 0 => {}, |