nu_cmd_lang/core_commands/
export_extern.rs

1use nu_engine::command_prelude::*;
2use nu_protocol::engine::CommandType;
3
4#[derive(Clone)]
5pub struct ExportExtern;
6
7impl Command for ExportExtern {
8    fn name(&self) -> &str {
9        "export extern"
10    }
11
12    fn description(&self) -> &str {
13        "Define an extern and export it from a module."
14    }
15
16    fn signature(&self) -> nu_protocol::Signature {
17        Signature::build("export extern")
18            .input_output_types(vec![(Type::Nothing, Type::Nothing)])
19            .required("def_name", SyntaxShape::String, "Definition name.")
20            .required("params", SyntaxShape::Signature, "Parameters.")
21            .category(Category::Core)
22    }
23
24    fn extra_description(&self) -> &str {
25        r#"This command is a parser keyword. For details, check:
26  https://www.nushell.sh/book/thinking_in_nu.html"#
27    }
28
29    fn command_type(&self) -> CommandType {
30        CommandType::Keyword
31    }
32
33    fn run(
34        &self,
35        _engine_state: &EngineState,
36        _stack: &mut Stack,
37        _call: &Call,
38        _input: PipelineData,
39    ) -> Result<PipelineData, ShellError> {
40        Ok(PipelineData::empty())
41    }
42
43    fn examples(&self) -> Vec<Example> {
44        vec![Example {
45            description: "Export the signature for an external command",
46            example: r#"export extern echo [text: string]"#,
47            result: None,
48        }]
49    }
50
51    fn search_terms(&self) -> Vec<&str> {
52        vec!["signature", "module", "declare"]
53    }
54}