From 9f02fb95685f46c390148eeab760e3a0dcfa49a9 Mon Sep 17 00:00:00 2001 From: Christian Duerr Date: Thu, 16 Jun 2022 17:01:13 +0200 Subject: Add value hints for clap file paths This ensures that the generated completions properly suggest file paths for arguments which accept them. --- alacritty/src/cli.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'alacritty/src') diff --git a/alacritty/src/cli.rs b/alacritty/src/cli.rs index 83b317b9..be377700 100644 --- a/alacritty/src/cli.rs +++ b/alacritty/src/cli.rs @@ -3,7 +3,7 @@ use std::path::PathBuf; #[cfg(unix)] use clap::Subcommand; -use clap::{Args, Parser}; +use clap::{Args, Parser, ValueHint}; use log::{self, error, LevelFilter}; use serde::{Deserialize, Serialize}; use serde_yaml::Value; @@ -31,22 +31,22 @@ pub struct Options { /// Specify alternative configuration file [default: $XDG_CONFIG_HOME/alacritty/alacritty.yml]. #[cfg(not(any(target_os = "macos", windows)))] - #[clap(long)] + #[clap(long, value_hint = ValueHint::FilePath)] pub config_file: Option, /// Specify alternative configuration file [default: %APPDATA%\alacritty\alacritty.yml]. #[cfg(windows)] - #[clap(long)] + #[clap(long, value_hint = ValueHint::FilePath)] pub config_file: Option, /// Specify alternative configuration file [default: $HOME/.config/alacritty/alacritty.yml]. #[cfg(target_os = "macos")] - #[clap(long)] + #[clap(long, value_hint = ValueHint::FilePath)] pub config_file: Option, /// Path for IPC socket creation. #[cfg(unix)] - #[clap(long)] + #[clap(long, value_hint = ValueHint::FilePath)] pub socket: Option, /// Reduces the level of verbosity (the min level is -qq). @@ -177,7 +177,7 @@ fn parse_class(input: &str) -> Result { #[derive(Serialize, Deserialize, Args, Default, Debug, Clone, PartialEq, Eq)] pub struct TerminalOptions { /// Start the shell in the specified working directory. - #[clap(long)] + #[clap(long, value_hint = ValueHint::FilePath)] pub working_directory: Option, /// Remain open after child process exit. @@ -260,7 +260,7 @@ pub enum Subcommands { #[derive(Args, Debug)] pub struct MessageOptions { /// IPC socket connection path override. - #[clap(long, short)] + #[clap(long, short, value_hint = ValueHint::FilePath)] pub socket: Option, /// Message which should be sent. -- cgit