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

Code before:

#[cfg(unix)]
use clap::Subcommand;
use clap::{Args, Parser, ValueHint};
use log::{self, error, LevelFilter};
use serde::{Deserialize, Serialize};
use serde_yaml::Value;

use alacritty_terminal::config::{Program, PtyConfig};

use crate::config::window::{Class, Identity, DEFAULT_NAME};
use crate::config::{serde_utils, UiConfig};

/// CLI options for the main Alacritty executable.
#[derive(Parser, Default, Debug)]
#[clap(author, about, version = env!("VERSION"))]
pub struct Options {
    /// Print all events to stdout.
    #[clap(long)]
    pub print_events: bool,

    /// Generates ref test.
    #[clap(long)]
    pub ref_test: bool,

    /// Defines the X11 window ID (as a decimal integer or hexadecimal starting with 0x) to embed Alacritty within.
    #[clap(long)]
    pub embed: Option<String>,

    /// Specify alternative configuration file [default: $XDG_CONFIG_HOME/alacritty/alacritty.yml].
    #[cfg(not(any(target_os = "macos", windows)))]
    #[clap(long, value_hint = ValueHint::FilePath)]
    pub config_file: Option<PathBuf>,

    /// Specify alternative configuration file [default: %APPDATA%\alacritty\alacritty.yml].
    #[cfg(windows)]
    #[clap(long, value_hint = ValueHint::FilePath)]
    pub config_file: Option<PathBuf>,

    /// Specify alternative configuration file [default: $HOME/.config/alacritty/alacritty.yml].
    #[cfg(target_os = "macos")]
    #[clap(long, value_hint = ValueHint::FilePath)]
    pub config_file: Option<PathBuf>,

    /// Path for IPC socket creation.
    #[cfg(unix)]
    #[clap(long, value_hint = ValueHint::FilePath)]
    pub socket: Option<PathBuf>,

    /// Reduces the level of verbosity (the min level is -qq).
    #[clap(short, conflicts_with("verbose"), parse(from_occurrences))]

Review comment (suggestion):
I think we can do much better than this.

Maybe something like that:

```
/// X11 window ID to embed Alacritty within (decimal or hexadecimal with "0x" prefix).
```

Code after:
use std::path::PathBuf;

#[cfg(unix)]
use clap::Subcommand;
use clap::{Args, Parser, ValueHint};
use log::{self, error, LevelFilter};
use serde::{Deserialize, Serialize};
use serde_yaml::Value;

use alacritty_terminal::config::{Program, PtyConfig};

use crate::config::window::{Class, Identity, DEFAULT_NAME};
use crate::config::{serde_utils, UiConfig};

/// CLI options for the main Alacritty executable.
#[derive(Parser, Default, Debug)]
#[clap(author, about, version = env!("VERSION"))]
pub struct Options {
    /// Print all events to stdout.
    #[clap(long)]
    pub print_events: bool,

    /// Generates ref test.
    #[clap(long)]
    pub ref_test: bool,

    /// X11 window ID to embed Alacritty within (decimal or hexadecimal with "0x" prefix).
    #[clap(long)]
    pub embed: Option<String>,

    /// Specify alternative configuration file [default: $XDG_CONFIG_HOME/alacritty/alacritty.yml].
    #[cfg(not(any(target_os = "macos", windows)))]
    #[clap(long, value_hint = ValueHint::FilePath)]
    pub config_file: Option<PathBuf>,

    /// Specify alternative configuration file [default: %APPDATA%\alacritty\alacritty.yml].
    #[cfg(windows)]
    #[clap(long, value_hint = ValueHint::FilePath)]
    pub config_file: Option<PathBuf>,

    /// Specify alternative configuration file [default: $HOME/.config/alacritty/alacritty.yml].
    #[cfg(target_os = "macos")]
    #[clap(long, value_hint = ValueHint::FilePath)]
    pub config_file: Option<PathBuf>,

    /// Path for IPC socket creation.
    #[cfg(unix)]
    #[clap(long, value_hint = ValueHint::FilePath)]
    pub socket: Option<PathBuf>,

    /// Reduces the level of verbosity (the min level is -qq).