Skip to main content

nu_command/filesystem/idx/
status.rs

1use super::state::current_status;
2use nu_engine::command_prelude::*;
3
4#[derive(Clone)]
5pub struct IdxStatus;
6
7impl Command for IdxStatus {
8    fn name(&self) -> &str {
9        "idx status"
10    }
11
12    fn signature(&self) -> Signature {
13        Signature::build(self.name())
14            .input_output_types(vec![(Type::Nothing, Type::record())])
15            .category(Category::FileSystem)
16    }
17
18    fn description(&self) -> &str {
19        "Show status information for the global in-memory idx runtime."
20    }
21
22    fn examples(&self) -> Vec<Example<'_>> {
23        vec![Example {
24            description: "Show the current idx runtime status",
25            example: "idx status",
26            result: None,
27        }]
28    }
29
30    fn run(
31        &self,
32        _engine_state: &EngineState,
33        _stack: &mut Stack,
34        call: &Call,
35        _input: PipelineData,
36    ) -> Result<PipelineData, ShellError> {
37        Ok(PipelineData::value(
38            current_status(None).to_value(call.head),
39            None,
40        ))
41    }
42}