Trait nu_protocol::engine::Command
source · pub trait Command: Send + Sync + CommandClone {
Show 19 methods
// Required methods
fn name(&self) -> &str;
fn signature(&self) -> Signature;
fn usage(&self) -> &str;
fn run(
&self,
engine_state: &EngineState,
stack: &mut Stack,
call: &Call,
input: PipelineData
) -> Result<PipelineData, ShellError>;
// Provided methods
fn extra_usage(&self) -> &str { ... }
fn run_const(
&self,
working_set: &StateWorkingSet<'_>,
call: &Call,
input: PipelineData
) -> Result<PipelineData, ShellError> { ... }
fn examples(&self) -> Vec<Example<'_>> { ... }
fn is_builtin(&self) -> bool { ... }
fn is_known_external(&self) -> bool { ... }
fn is_alias(&self) -> bool { ... }
fn as_alias(&self) -> Option<&Alias> { ... }
fn is_custom_command(&self) -> bool { ... }
fn is_sub(&self) -> bool { ... }
fn is_parser_keyword(&self) -> bool { ... }
fn is_plugin(&self) -> Option<(&Path, Option<&Path>)> { ... }
fn is_const(&self) -> bool { ... }
fn get_block_id(&self) -> Option<BlockId> { ... }
fn search_terms(&self) -> Vec<&str> { ... }
fn command_type(&self) -> CommandType { ... }
}
Required Methods§
fn name(&self) -> &str
fn signature(&self) -> Signature
fn usage(&self) -> &str
fn run( &self, engine_state: &EngineState, stack: &mut Stack, call: &Call, input: PipelineData ) -> Result<PipelineData, ShellError>
Provided Methods§
fn extra_usage(&self) -> &str
sourcefn run_const(
&self,
working_set: &StateWorkingSet<'_>,
call: &Call,
input: PipelineData
) -> Result<PipelineData, ShellError>
fn run_const( &self, working_set: &StateWorkingSet<'_>, call: &Call, input: PipelineData ) -> Result<PipelineData, ShellError>
Used by the parser to run command at parse time
If a command has is_const()
set to true, it must also implement this method.