[−][src]Trait duckscript::types::command::Command
Defines the command capabilities
Required methods
fn name(&self) -> String
The full command name which can be used to invoke this command.
fn clone_and_box(&self) -> Box<dyn Command>
Clones the command and returns a box reference.
Provided methods
fn aliases(&self) -> Vec<String>
A list of aliases that can also be used to invoke this command.
fn help(&self) -> String
Command documentation.
fn requires_context(&self) -> bool
If true the run with the context will be invoked.
fn run(&self, _arguments: Vec<String>) -> CommandResult
Runs the given instruction
fn run_with_context(
&self,
_arguments: Vec<String>,
_state: &mut HashMap<String, StateValue>,
_variables: &mut HashMap<String, String>,
_output_variable: Option<String>,
_instructions: &Vec<Instruction>,
_commands: &mut Commands,
_line: usize
) -> CommandResult
&self,
_arguments: Vec<String>,
_state: &mut HashMap<String, StateValue>,
_variables: &mut HashMap<String, String>,
_output_variable: Option<String>,
_instructions: &Vec<Instruction>,
_commands: &mut Commands,
_line: usize
) -> CommandResult
Run the instruction with access to the runtime context.
Arguments
arguments
- The command arguments arraystate
- Internal state which is only used by commands to store/pull datavariables
- All script variablesoutput_variable
- The output variable name (if defined)instructions
- The entire list of instructions which make up the currently running scriptcommands
- The currently known commandsline
- The current instruction line number (global line number after including all scripts into one global script)