Struct nu_protocol::PluginSignature
source · pub struct PluginSignature {
pub sig: Signature,
pub examples: Vec<PluginExample>,
}Expand description
A simple wrapper for Signature that includes examples.
Fields§
§sig: Signature§examples: Vec<PluginExample>Implementations§
source§impl PluginSignature
impl PluginSignature
pub fn new(sig: Signature, examples: Vec<PluginExample>) -> Self
sourcepub fn add_help(self) -> PluginSignature
pub fn add_help(self) -> PluginSignature
Add a default help option to a signature
sourcepub fn build(name: impl Into<String>) -> PluginSignature
pub fn build(name: impl Into<String>) -> PluginSignature
Build an internal signature with default help option
sourcepub fn usage(self, msg: impl Into<String>) -> PluginSignature
pub fn usage(self, msg: impl Into<String>) -> PluginSignature
Add a description to the signature
sourcepub fn extra_usage(self, msg: impl Into<String>) -> PluginSignature
pub fn extra_usage(self, msg: impl Into<String>) -> PluginSignature
Add an extra description to the signature
sourcepub fn search_terms(self, terms: Vec<String>) -> PluginSignature
pub fn search_terms(self, terms: Vec<String>) -> PluginSignature
Add search terms to the signature
sourcepub fn update_from_command(self, command: &dyn Command) -> PluginSignature
pub fn update_from_command(self, command: &dyn Command) -> PluginSignature
Update signature’s fields from a Command trait implementation
sourcepub fn allows_unknown_args(self) -> PluginSignature
pub fn allows_unknown_args(self) -> PluginSignature
Allow unknown signature parameters
sourcepub fn required(
self,
name: impl Into<String>,
shape: impl Into<SyntaxShape>,
desc: impl Into<String>
) -> PluginSignature
pub fn required( self, name: impl Into<String>, shape: impl Into<SyntaxShape>, desc: impl Into<String> ) -> PluginSignature
Add a required positional argument to the signature
sourcepub fn optional(
self,
name: impl Into<String>,
shape: impl Into<SyntaxShape>,
desc: impl Into<String>
) -> PluginSignature
pub fn optional( self, name: impl Into<String>, shape: impl Into<SyntaxShape>, desc: impl Into<String> ) -> PluginSignature
Add an optional positional argument to the signature
pub fn rest( self, name: &str, shape: impl Into<SyntaxShape>, desc: impl Into<String> ) -> PluginSignature
sourcepub fn operates_on_cell_paths(&self) -> bool
pub fn operates_on_cell_paths(&self) -> bool
Is this command capable of operating on its input via cell paths?
sourcepub fn named(
self,
name: impl Into<String>,
shape: impl Into<SyntaxShape>,
desc: impl Into<String>,
short: Option<char>
) -> PluginSignature
pub fn named( self, name: impl Into<String>, shape: impl Into<SyntaxShape>, desc: impl Into<String>, short: Option<char> ) -> PluginSignature
Add an optional named flag argument to the signature
sourcepub fn required_named(
self,
name: impl Into<String>,
shape: impl Into<SyntaxShape>,
desc: impl Into<String>,
short: Option<char>
) -> PluginSignature
pub fn required_named( self, name: impl Into<String>, shape: impl Into<SyntaxShape>, desc: impl Into<String>, short: Option<char> ) -> PluginSignature
Add a required named flag argument to the signature
sourcepub fn switch(
self,
name: impl Into<String>,
desc: impl Into<String>,
short: Option<char>
) -> PluginSignature
pub fn switch( self, name: impl Into<String>, desc: impl Into<String>, short: Option<char> ) -> PluginSignature
Add a switch to the signature
sourcepub fn input_output_type(
self,
input_type: Type,
output_type: Type
) -> PluginSignature
pub fn input_output_type( self, input_type: Type, output_type: Type ) -> PluginSignature
Changes the input type of the command signature
sourcepub fn input_output_types(
self,
input_output_types: Vec<(Type, Type)>
) -> PluginSignature
pub fn input_output_types( self, input_output_types: Vec<(Type, Type)> ) -> PluginSignature
Set the input-output type signature variants of the command
sourcepub fn category(self, category: Category) -> PluginSignature
pub fn category(self, category: Category) -> PluginSignature
Changes the signature category
sourcepub fn creates_scope(self) -> PluginSignature
pub fn creates_scope(self) -> PluginSignature
Sets that signature will create a scope as it parses
pub fn allow_variants_without_examples(self, allow: bool) -> PluginSignature
pub fn call_signature(&self) -> String
sourcepub fn get_shorts(&self) -> Vec<char>
pub fn get_shorts(&self) -> Vec<char>
Get list of the short-hand flags
pub fn get_positional(&self, position: usize) -> Option<PositionalArg>
pub fn num_positionals(&self) -> usize
pub fn num_positionals_after(&self, idx: usize) -> usize
sourcepub fn get_long_flag(&self, name: &str) -> Option<Flag>
pub fn get_long_flag(&self, name: &str) -> Option<Flag>
Find the matching long flag
sourcepub fn get_short_flag(&self, short: char) -> Option<Flag>
pub fn get_short_flag(&self, short: char) -> Option<Flag>
Find the matching long flag
sourcepub fn filter(self) -> PluginSignature
pub fn filter(self) -> PluginSignature
Set the filter flag for the signature
sourcepub fn predeclare(self) -> Box<dyn Command>
pub fn predeclare(self) -> Box<dyn Command>
Create a placeholder implementation of Command as a way to predeclare a definition’s signature so other definitions can see it. This placeholder is later replaced with the full definition in a second pass of the parser.
sourcepub fn into_block_command(self, block_id: BlockId) -> Box<dyn Command>
pub fn into_block_command(self, block_id: BlockId) -> Box<dyn Command>
Combines a signature and a block into a runnable block
pub fn formatted_flags(self) -> String
pub fn plugin_examples(self, examples: Vec<PluginExample>) -> PluginSignature
Trait Implementations§
source§impl Clone for PluginSignature
impl Clone for PluginSignature
source§fn clone(&self) -> PluginSignature
fn clone(&self) -> PluginSignature
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for PluginSignature
impl Debug for PluginSignature
source§impl<'de> Deserialize<'de> for PluginSignature
impl<'de> Deserialize<'de> for PluginSignature
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl !RefUnwindSafe for PluginSignature
impl Send for PluginSignature
impl Sync for PluginSignature
impl Unpin for PluginSignature
impl !UnwindSafe for PluginSignature
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> IntoSpanned for T
impl<T> IntoSpanned for T
source§impl<D> OwoColorize for D
impl<D> OwoColorize for D
source§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
source§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
source§fn black(&self) -> FgColorDisplay<'_, Black, Self>
fn black(&self) -> FgColorDisplay<'_, Black, Self>
source§fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
source§fn red(&self) -> FgColorDisplay<'_, Red, Self>
fn red(&self) -> FgColorDisplay<'_, Red, Self>
source§fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
source§fn green(&self) -> FgColorDisplay<'_, Green, Self>
fn green(&self) -> FgColorDisplay<'_, Green, Self>
source§fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
source§fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
source§fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
source§fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
source§fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
source§fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
source§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
source§fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
source§fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
source§fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
source§fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
source§fn white(&self) -> FgColorDisplay<'_, White, Self>
fn white(&self) -> FgColorDisplay<'_, White, Self>
source§fn on_white(&self) -> BgColorDisplay<'_, White, Self>
fn on_white(&self) -> BgColorDisplay<'_, White, Self>
source§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
source§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
source§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
source§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
source§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
source§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
source§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
source§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
source§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
source§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
source§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
source§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
source§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
source§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
source§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
source§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
source§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
source§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
source§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
source§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
source§fn bold(&self) -> BoldDisplay<'_, Self>
fn bold(&self) -> BoldDisplay<'_, Self>
source§fn dimmed(&self) -> DimDisplay<'_, Self>
fn dimmed(&self) -> DimDisplay<'_, Self>
source§fn italic(&self) -> ItalicDisplay<'_, Self>
fn italic(&self) -> ItalicDisplay<'_, Self>
source§fn underline(&self) -> UnderlineDisplay<'_, Self>
fn underline(&self) -> UnderlineDisplay<'_, Self>
source§fn blink(&self) -> BlinkDisplay<'_, Self>
fn blink(&self) -> BlinkDisplay<'_, Self>
source§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
source§fn reversed(&self) -> ReversedDisplay<'_, Self>
fn reversed(&self) -> ReversedDisplay<'_, Self>
source§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
source§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg or
a color-specific method, such as OwoColorize::green, Read moresource§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg or
a color-specific method, such as OwoColorize::on_yellow, Read more