[][src]Enum clap::ValueHint

[]
pub enum ValueHint {
    Unknown,
    Other,
    AnyPath,
    FilePath,
    DirPath,
    ExecutablePath,
    CommandName,
    CommandString,
    CommandWithArguments,
    Username,
    Hostname,
    Url,
    EmailAddress,
}
[]

Provides hints about argument types for shell command completion.

See the clap_generate crate for completion script generation.

Overview of which hints are supported by which shell:

Hintzshfish1
AnyPathYesYes
FilePathYesYes
DirPathYesYes
ExecutablePathYesPartial
CommandNameYesYes
CommandStringYesPartial
CommandWithArgumentsYes
UsernameYesYes
HostnameYesYes
UrlYes
EmailAddressYes

  1. 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 sudo or env.

This hint is special, the argument must be a positional argument and have .multiple(true) and App must use AppSettings::TrailingVarArg. The result is that the command line my_app ls -la / will be parsed as ["ls", "-la", "/"] and clap won't try to parse the -la argument itself.

Username
[]

Name of a local operating system user.

Hostname
[]

Host name of a computer. Shells usually parse /etc/hosts and .ssh/known_hosts to complete hostnames.

Url
[]

Complete web address.

EmailAddress
[]

Email address.

Trait Implementations

impl Clone for ValueHint[src][+]

impl Copy for ValueHint[src]

impl Debug for ValueHint[src][+]

impl Default for ValueHint[src][+]

impl FromStr for ValueHint[src][+]

type Err = String

The associated error which can be returned from parsing.

impl PartialEq<ValueHint> for ValueHint[src][+]

impl StructuralPartialEq for ValueHint[src]

Auto Trait Implementations

impl RefUnwindSafe for ValueHint

impl Send for ValueHint

impl Sync for ValueHint

impl Unpin for ValueHint

impl UnwindSafe for ValueHint

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src][+]

impl<T> Borrow<T> for T where
    T: ?Sized
[src][+]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src][+]

impl<T> From<T> for T[src][+]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src][+]

impl<T> ToOwned for T where
    T: Clone
[src][+]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src][+]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src][+]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.