Skip to main content

nu_command/filesystem/idx/
dirs.rs

1use super::state::stream_dirs;
2use nu_engine::command_prelude::*;
3#[derive(Clone)]
4pub struct IdxDirs;
5
6impl Command for IdxDirs {
7    fn name(&self) -> &str {
8        "idx dirs"
9    }
10
11    fn signature(&self) -> Signature {
12        Signature::build(self.name())
13            .input_output_types(vec![(Type::Nothing, Type::List(Box::new(Type::record())))])
14            .category(Category::FileSystem)
15    }
16
17    fn description(&self) -> &str {
18        "List indexed directories from idx state."
19    }
20
21    fn examples(&self) -> Vec<Example<'_>> {
22        vec![Example {
23            description: "List all indexed directories",
24            example: "idx dirs",
25            result: None,
26        }]
27    }
28
29    fn run(
30        &self,
31        engine_state: &EngineState,
32        _stack: &mut Stack,
33        call: &Call,
34        _input: PipelineData,
35    ) -> Result<PipelineData, ShellError> {
36        let signals = engine_state.signals();
37        stream_dirs(call.head, signals)
38    }
39}