Skip to main content

nu_command/filesystem/idx/
idx_.rs

1use nu_engine::{command_prelude::*, get_full_help};
2
3#[derive(Clone)]
4pub struct Idx;
5
6impl Command for Idx {
7    fn name(&self) -> &str {
8        "idx"
9    }
10
11    fn signature(&self) -> Signature {
12        Signature::build("idx")
13            .input_output_types(vec![(Type::Nothing, Type::String)])
14            .category(Category::FileSystem)
15    }
16
17    fn description(&self) -> &str {
18        "Manage in-memory file index state."
19    }
20
21    fn extra_description(&self) -> &str {
22        "Use one of the subcommands: init, status, find, search, watch, drop, dirs, files. \
23By default `idx init` enables filesystem watching so the index updates as files change; pass `--no-watch` for a static index. \
24Use `idx watch` to stream change events from that live index into a pipeline."
25    }
26
27    fn run(
28        &self,
29        engine_state: &EngineState,
30        stack: &mut Stack,
31        call: &Call,
32        _input: PipelineData,
33    ) -> Result<PipelineData, ShellError> {
34        Ok(Value::string(
35            get_full_help(self, engine_state, stack, call.head),
36            call.head,
37        )
38        .into_pipeline_data())
39    }
40}