nu_cmd_lang/core_commands/attr/
attr_.rs

1use nu_engine::{command_prelude::*, get_full_help};
2
3#[derive(Clone)]
4pub struct Attr;
5
6impl Command for Attr {
7    fn name(&self) -> &str {
8        "attr"
9    }
10
11    fn signature(&self) -> Signature {
12        Signature::build("attr")
13            .category(Category::Core)
14            .input_output_types(vec![(Type::Nothing, Type::String)])
15    }
16
17    fn description(&self) -> &str {
18        "Various attributes for custom commands."
19    }
20
21    fn extra_description(&self) -> &str {
22        "\
23            You must use one of the following subcommands. \
24            Using this command as-is will only produce this help message.\
25        "
26    }
27
28    fn run(
29        &self,
30        engine_state: &EngineState,
31        stack: &mut Stack,
32        call: &Call,
33        _input: PipelineData,
34    ) -> Result<PipelineData, ShellError> {
35        Ok(Value::string(get_full_help(self, engine_state, stack), call.head).into_pipeline_data())
36    }
37}