/ src / cli.rs
cli.rs
 1  use std::path::PathBuf;
 2  
 3  use clap::{Args, Parser, Subcommand};
 4  
 5  pub mod build;
 6  pub mod query;
 7  
 8  #[derive(Debug, Parser)]
 9  pub struct Options {
10      #[command(subcommand)]
11      pub commands: Commands,
12  }
13  
14  #[derive(Debug, Subcommand)]
15  pub enum Commands {
16      Build(Build),
17      Query(Query),
18  }
19  
20  #[derive(Debug, Args)]
21  pub struct Build {
22      /// Path to where the index is stored
23      // TODO: make this optional and use .radicle/radix
24      #[arg(long, short)]
25      pub path: PathBuf,
26  }
27  
28  #[derive(Debug, Args)]
29  pub struct Query {
30      /// Path to where the index is stored
31      // TODO: make this optional and use .radicle/radix
32      #[arg(long, short)]
33      pub path: PathBuf,
34      /// Query string for requesting from the index
35      #[arg(long, short)]
36      pub query: String,
37      /// Limit the number of documents returned by the query.
38      #[arg(long, short)]
39      pub limit: usize,
40  }