join_ai/
cli.rs

1use clap::Parser;
2use std::path::PathBuf;
3
4/// A CLI application to traverse files in a folder and concatenate them
5/// into a single text file, suitable for GenAI model input.
6#[derive(Parser, Debug, Clone)]
7#[command(author, version, about, long_about = None)]
8pub struct Args {
9    /// The input folder to traverse for files
10    #[arg(required = true)]
11    pub input_folder: PathBuf,
12
13    /// The output file to write the concatenated content to
14    #[arg(short, long, default_value = "concatenated.txt")]
15    pub output_file: PathBuf,
16
17    /// File patterns to include. Can be specified multiple times (e.g., -p "*.rs" -p "*.md")
18    #[arg(short, long, action = clap::ArgAction::Append)]
19    pub patterns: Option<Vec<String>>,
20
21    /// Clear the output file before writing
22    #[arg(short, long)]
23    pub clear_file: bool,
24
25    /// Folders to exclude from the search. Can be specified multiple times.
26    #[arg(short, long, action = clap::ArgAction::Append)]
27    pub exclude_folders: Option<Vec<String>>,
28
29    /// File extensions to exclude. Can be specified multiple times.
30    #[arg(long, action = clap::ArgAction::Append)]
31    pub exclude_extensions: Option<Vec<String>>,
32
33    /// Set the maximum search depth
34    #[arg(long)]
35    pub max_depth: Option<usize>,
36
37    /// Include hidden files in the search
38    #[arg(long)]
39    pub hidden: bool,
40
41    /// Do not follow symlinks
42    #[arg(long, default_value_t = true)]
43    pub no_follow: bool,
44}