Repository: alacritty/alacritty
File: alacritty/src/cli.rs (Rust)

Code before:
    #[clap(short, conflicts_with("verbose"), action = ArgAction::Count)]
    quiet: u8,

    /// Increases the level of verbosity (the max level is -vvv).
    #[clap(short, conflicts_with("quiet"), action = ArgAction::Count)]
    verbose: u8,

    /// Override configuration file options [example: cursor.style=Beam].
    #[clap(short = 'o', long, num_args = 1..)]
    option: Vec<String>,

    /// CLI options for config overrides.
    #[clap(skip)]
    pub config_options: TomlValue,

    /// Options which can be passed via IPC.
    #[clap(flatten)]
    pub window_options: WindowOptions,

    /// Subcommand passed to the CLI.
    #[clap(subcommand)]
    pub subcommands: Option<Subcommands>,

    /// Use EGL as display API if the current platform allows it.
    #[clap(long)]
    pub prefer_egl: bool,
}

impl Options {
    pub fn new() -> Self {
        let mut options = Self::parse();

        // Convert `--option` flags into serde `Value`.
        options.config_options = TomlValue(options_as_value(&options.option));

        options
    }

    /// Override configuration file with options from the CLI.
    pub fn override_config(&self, config: &mut UiConfig) {
        #[cfg(unix)]
        {
            config.ipc_socket |= self.socket.is_some();
        }

        config.window.dynamic_title &= self.window_options.window_identity.title.is_none();
        config.window.embed = self.embed.as_ref().and_then(|embed| parse_hex_or_decimal(embed));
        config.debug.print_events |= self.print_events;
        config.debug.log_level = max(config.debug.log_level, self.log_level());
        config.debug.ref_test |= self.ref_test;
        config.debug.prefer_egl |= self.prefer_egl;

Review comment (bug):
We don't special options like that for debug settings, they could be set via the `-o`.

Code after:
    #[clap(short, conflicts_with("verbose"), action = ArgAction::Count)]
    quiet: u8,

    /// Increases the level of verbosity (the max level is -vvv).
    #[clap(short, conflicts_with("quiet"), action = ArgAction::Count)]
    verbose: u8,

    /// Override configuration file options [example: cursor.style=Beam].
    #[clap(short = 'o', long, num_args = 1..)]
    option: Vec<String>,

    /// CLI options for config overrides.
    #[clap(skip)]
    pub config_options: TomlValue,

    /// Options which can be passed via IPC.
    #[clap(flatten)]
    pub window_options: WindowOptions,

    /// Subcommand passed to the CLI.
    #[clap(subcommand)]
    pub subcommands: Option<Subcommands>,
}

impl Options {
    pub fn new() -> Self {
        let mut options = Self::parse();

        // Convert `--option` flags into serde `Value`.
        options.config_options = TomlValue(options_as_value(&options.option));

        options
    }

    /// Override configuration file with options from the CLI.
    pub fn override_config(&self, config: &mut UiConfig) {
        #[cfg(unix)]
        {
            config.ipc_socket |= self.socket.is_some();
        }

        config.window.dynamic_title &= self.window_options.window_identity.title.is_none();
        config.window.embed = self.embed.as_ref().and_then(|embed| parse_hex_or_decimal(embed));
        config.debug.print_events |= self.print_events;
        config.debug.log_level = max(config.debug.log_level, self.log_level());
        config.debug.ref_test |= self.ref_test;

        if config.debug.print_events {
            config.debug.log_level = max(config.debug.log_level, LevelFilter::Info);
        }
    }