github_code_searching_lib/
args.rs

1use clap::Parser;
2
3/// GitHub Code Search CLI tool for searching code on GitHub with advanced features
4/// including concurrency control, rate-limit handling and progress visualization.
5#[derive(Parser)]
6#[clap(
7    author,
8    version,
9    about,
10    long_about = "A powerful, concurrent CLI tool for searching code across GitHub repositories with advanced rate-limit handling and progress visualization."
11)]
12pub struct Args {
13    /// Words or phrases to search for in GitHub code.
14    #[clap(short, long, num_args = 1.., required = true)]
15    pub words: Vec<String>,
16
17    /// Output file path for search results in JSON format.
18    #[clap(short, long, default_value = "search_results.json")]
19    pub output: String,
20
21    /// Maximum number of pages to retrieve per search term.
22    /// Each page contains up to 100 results.
23    #[clap(short = 'p', long, value_name = "NUM")]
24    pub max_pages: Option<u32>,
25
26    /// GitHub API token for authentication.
27    #[clap(short, long)]
28    pub token: Option<String>,
29
30    /// Maximum number of concurrent searches.
31    #[clap(short = 'c', long, default_value = "4")]
32    pub concurrency: usize,
33
34    /// Include only files with these extensions (e.g., "rs,js,py")
35    #[clap(long = "include", value_delimiter = ',')]
36    pub include_extensions: Option<Vec<String>>,
37
38    /// Exclude files with these extensions (e.g., "md,txt,json")
39    #[clap(long = "exclude", value_delimiter = ',')]
40    pub exclude_extensions: Option<Vec<String>>,
41}