Enum ValueHint
enum ValueHint
Provide shell with hint on how to complete an argument.
See [Arg::value_hint][crate::Arg::value_hint] to set this on an argument.
See the clap_complete crate for completion script generation.
Overview of which hints are supported by which shell:
| Hint | zsh | fish1 | dynamic |
|---|---|---|---|
AnyPath |
Yes | Yes | Yes |
FilePath |
Yes | Yes | Yes |
DirPath |
Yes | Yes | Yes |
ExecutablePath |
Yes | Partial | Yes |
CommandName |
Yes | Yes | No |
CommandString |
Yes | Partial | No |
CommandWithArguments |
Yes | No | |
Username |
Yes | Yes | No |
Hostname |
Yes | Yes | No |
Url |
Yes | No | |
EmailAddress |
Yes | No |
-
fish completions currently only support named arguments (e.g. -o or --opt), not positional arguments. ↩
Variants
-
Unknown Default value if hint is not specified. Follows shell default behavior, which is usually auto-completing filenames.
-
Other None of the hints below apply. Disables shell completion for this argument.
-
AnyPath Any existing path.
-
FilePath Path to a file.
-
DirPath Path to a directory.
-
ExecutablePath Path to an executable file.
-
CommandName Name of a command, without arguments. May be relative to PATH, or full path to executable.
-
CommandString A single string containing a command and its arguments.
-
CommandWithArguments Capture the remaining arguments as a command name and arguments for that command. This is common when writing shell wrappers that execute anther command, for example
sudoorenv.This hint is special, the argument must be a positional argument and have
.num_args(1..)and Command must useCommand::trailing_var_arg(true). The result is that the command linemy_app ls -la /will be parsed as["ls", "-la", "/"]and clap won't try to parse the-laargument itself.-
Username Name of a local operating system user.
-
Hostname Host name of a computer. Shells usually parse
/etc/hostsand.ssh/known_hoststo complete hostnames.-
Url Complete web address.
-
EmailAddress Email address.
Implementations
impl Clone for ValueHint
fn clone(self: &Self) -> ValueHint
impl Copy for ValueHint
impl Debug for ValueHint
fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<'_>) -> $crate::fmt::Result
impl Default for ValueHint
fn default() -> ValueHint
impl Eq for ValueHint
impl Freeze for ValueHint
impl FromStr for ValueHint
fn from_str(s: &str) -> Result<Self, <Self as FromStr>::Err>
impl Hash for ValueHint
fn hash<__H: $crate::hash::Hasher>(self: &Self, state: &mut __H)
impl IntoResettable for crate::builder::ValueHint
fn into_resettable(self: Self) -> Resettable<ValueHint>
impl PartialEq for ValueHint
fn eq(self: &Self, other: &ValueHint) -> bool
impl RefUnwindSafe for ValueHint
impl Send for ValueHint
impl StructuralPartialEq for ValueHint
impl Sync for ValueHint
impl Unpin for ValueHint
impl UnwindSafe for ValueHint
impl<T> Any for ValueHint
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for ValueHint
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for ValueHint
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> CloneToUninit for ValueHint
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)
impl<T> From for ValueHint
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for ValueHint
fn to_owned(self: &Self) -> Tfn clone_into(self: &Self, target: &mut T)
impl<T, U> Into for ValueHint
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for ValueHint
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for ValueHint
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>