use std::path::PathBuf; use clap::{Args, Parser}; #[derive(Debug, Clone, Default, Parser)] #[command(author, version, about)] pub struct Config { #[command(flatten)] pub search: Search, #[command(flatten)] pub parsers: Projects, /// Add any current tmux session's paths to output. /// /// Uses the tmux session's `session_path`. #[arg(short = 'T', long = "sessions")] pub tmux_sessions: bool, /// Include arbitrary directories in output /// /// Note: Directories added by this flag are still filtered and sorted based on supplied /// options. #[arg(short = 'P', long = "project")] pub include: Vec, /// Print additional information per occurrence. /// /// Conflicts with `--quiet`. #[arg(short, long, global = true, action = clap::ArgAction::Count)] pub verbosity: u8, } #[derive(Debug, Default, Clone, Args)] pub struct Search { /// Directories to search. /// /// Directories are searched recursively based on `--max-depth`. pub paths: Vec, /// Recurse into hidden directories. /// /// Traverse into hidden directories while searching. A directory is considered hidden /// if its name starts with a `.` sign (dot). If `--max-depth` is 0, this has no effect. #[arg(long)] pub hidden: bool, /// Max depth to recurse. /// /// MAX_DEPTH of 0 will only return the supplied PATHS. #[arg(short = 'd', long, default_value = "1")] pub max_depth: Option, } #[derive(Debug, Default, Clone, Args)] pub struct Projects { /// Exclude matching sessions from output. #[arg(short, long = "exclude")] pub excludes: Vec, /// Exclude current working directory from output. #[arg(short = 'E', long)] pub exclude_cwd: bool, /// Match all child directories. /// /// Uses the directory mtime as the timestamp. #[arg(short, long)] pub mtime: bool, /// Match directories containing . /// /// Uses the directory mtime as the timestamp. PATTERN should be a path relative to the /// searched directory. #[arg(long, short)] pub pattern: Option, /// Match git repositories. /// /// Uses the most recient commit as the timestamp. #[cfg(feature = "git")] #[arg(long, short)] pub git: bool, /// Use existing tmux sessions for project timestamps /// /// Note: This only used for sorting projects using `session_last_attached` (or /// `session_created` if not yet attached). For adding existing tmux session's paths to the /// output, see `-T|--sessions`. #[arg(long, short)] pub tmux: bool, }