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<'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
§impl<D> OwoColorize for D
impl<D> OwoColorize for D
§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
§fn on_yellow<'a>(&'a self) -> BgColorDisplay<'a, Yellow, Self>
fn on_yellow<'a>(&'a self) -> BgColorDisplay<'a, Yellow, Self>
§fn magenta<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>
fn magenta<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>
§fn on_magenta<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_magenta<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
§fn on_purple<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_purple<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
§fn default_color<'a>(&'a self) -> FgColorDisplay<'a, Default, Self>
fn default_color<'a>(&'a self) -> FgColorDisplay<'a, Default, Self>
§fn on_default_color<'a>(&'a self) -> BgColorDisplay<'a, Default, Self>
fn on_default_color<'a>(&'a self) -> BgColorDisplay<'a, Default, Self>
§fn bright_black<'a>(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
fn bright_black<'a>(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
§fn on_bright_black<'a>(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
fn on_bright_black<'a>(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
§fn bright_red<'a>(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
fn bright_red<'a>(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
§fn on_bright_red<'a>(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
fn on_bright_red<'a>(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
§fn bright_green<'a>(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
fn bright_green<'a>(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
§fn on_bright_green<'a>(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
fn on_bright_green<'a>(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
§fn bright_yellow<'a>(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
fn bright_yellow<'a>(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
§fn on_bright_yellow<'a>(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
fn on_bright_yellow<'a>(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
§fn bright_blue<'a>(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
fn bright_blue<'a>(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
§fn on_bright_blue<'a>(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
fn on_bright_blue<'a>(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
§fn bright_magenta<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_magenta<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
§fn on_bright_magenta<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_magenta<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
§fn bright_purple<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_purple<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
§fn on_bright_purple<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_purple<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
§fn bright_cyan<'a>(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
fn bright_cyan<'a>(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
§fn on_bright_cyan<'a>(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
fn on_bright_cyan<'a>(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
§fn bright_white<'a>(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
fn bright_white<'a>(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
§fn on_bright_white<'a>(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
fn on_bright_white<'a>(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
§fn blink_fast<'a>(&'a self) -> BlinkFastDisplay<'a, Self>
fn blink_fast<'a>(&'a self) -> BlinkFastDisplay<'a, Self>
§fn strikethrough<'a>(&'a self) -> StrikeThroughDisplay<'a, Self>
fn strikethrough<'a>(&'a self) -> StrikeThroughDisplay<'a, Self>
§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 more§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