nu_cmd_lang/core_commands/
export_extern.rs1use 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(
20 "def_name",
21 SyntaxShape::String,
22 "The name of the external command signature to define and export.",
23 )
24 .required(
25 "params",
26 SyntaxShape::Signature,
27 "The parameters for the external command signature.",
28 )
29 .category(Category::Core)
30 }
31
32 fn extra_description(&self) -> &str {
33 r#"This command is a parser keyword. For details, check:
34 https://www.nushell.sh/book/thinking_in_nu.html"#
35 }
36
37 fn command_type(&self) -> CommandType {
38 CommandType::Keyword
39 }
40
41 fn run(
42 &self,
43 _engine_state: &EngineState,
44 _stack: &mut Stack,
45 _call: &Call,
46 _input: PipelineData,
47 ) -> Result<PipelineData, ShellError> {
48 Ok(PipelineData::empty())
49 }
50
51 fn examples(&self) -> Vec<Example<'_>> {
52 vec![Example {
53 description: "Export the signature for an external command.",
54 example: r#"export extern echo [text: string]"#,
55 result: None,
56 }]
57 }
58
59 fn search_terms(&self) -> Vec<&str> {
60 vec!["signature", "module", "declare"]
61 }
62}