pub struct CommandArgument {
pub untrimmed: String,
pub text: String,
}
Expand description
Argument text following a command name.
Fields§
§untrimmed: String
Original text of the command argument.
text: String
Argument to the command with leading spaces stripped.
Implementations§
Source§impl CommandArgument
impl CommandArgument
Sourcepub fn filenames<W>(&self) -> Result<Vec<OpenTarget<W>>, CommandError>where
W: ApplicationWindowId,
pub fn filenames<W>(&self) -> Result<Vec<OpenTarget<W>>, CommandError>where
W: ApplicationWindowId,
Interpret the argument text as a collection of filenames.
This is similar to CommandArgument::strings, but in addition to processing escaped spaces and quoted strings, this will:
- turn lone
#
characters into OpenTarget::Alternate - turn lone
%
characters into OpenTarget::Current
These values can be escaped. For example, \#
will become OpenTarget::Name("#")
.
Sourcepub fn strings(&self) -> Result<Vec<String>, CommandError>
pub fn strings(&self) -> Result<Vec<String>, CommandError>
Interpret the argument text as a collection of strings.
Values containing spaces can either be quoted, or escaped with a backslash. (For example,
My\ File.txt
or `“My File.txt”)
Sourcepub fn options(&self) -> Result<Vec<OptionType>, CommandError>
pub fn options(&self) -> Result<Vec<OptionType>, CommandError>
Interpret the argument text as a series of positional arguments and flags starting with
++
.
Sourcepub fn range(&self) -> Result<RangeSpec, CommandError>
pub fn range(&self) -> Result<RangeSpec, CommandError>
Interpret the argument text as a range specification.
This can be used to create commands that take a range specification either before or after the command name.