use clap::Parser;
#[derive(Parser, Debug)]
#[command(
name = "loc",
version = env!("CARGO_PKG_VERSION"),
author = "kelexine <https://github.com/kelexine>",
about = "Advanced LOC counter — functions, git dates, parallel scan, JSON/CSV export",
after_help = "\
EXAMPLES:
loc Count LOC in current directory
loc src/ Scan a specific directory
loc -d Show per-extension breakdown
loc -f Extract and list functions/methods
loc -f --func-analysis Full function complexity report
loc -t rust python Only scan Rust and Python files
loc -e results.json Export to JSON
loc -e stats.csv -f Export CSV with function data
loc --warn-size 500 Warn about files > 500 lines
loc --git-dates Use git log for last-modified dates
loc src/ -d -t rust -f -e out.json
SUPPORTED LANGUAGES:
python, javascript, typescript, rust, go, java, kotlin, swift,
c, cpp, csharp, ruby, php, html, css, shell, sql, markdown,
json, yaml, xml, jsx, vue, svelte, toml, scala, haskell, elixir, lua, zig, nim
FUNCTION EXTRACTION:
Rust, Python, JavaScript/TypeScript, Go, C/C++, Java/Kotlin/C#, PHP, Swift, Ruby"
)]
pub struct Args {
#[arg(default_value = ".")]
pub directory: String,
#[arg(short = 'd', long = "detailed")]
pub detailed: bool,
#[arg(short = 'b', long = "binary")]
pub binary: bool,
#[arg(short = 'f', long = "functions")]
pub functions: bool,
#[arg(long = "func-analysis")]
pub func_analysis: bool,
#[arg(short = 't', long = "type", value_name = "LANG", num_args = 1..)]
pub file_types: Vec<String>,
#[arg(short = 'e', long = "export", value_name = "FILE")]
pub export: Option<String>,
#[arg(long = "warn-size", value_name = "LINES")]
pub warn_size: Option<usize>,
#[arg(long = "git-dates")]
pub git_dates: bool,
#[arg(long = "no-parallel")]
pub no_parallel: bool,
#[arg(short = 'H', long = "include-hidden")]
pub include_hidden: bool,
#[arg(long = "tree")]
pub tree: bool,
}