use crate::filter::SortKey;
use clap::Parser;
#[derive(Parser, Debug)]
#[command(
name = "csess",
version = concat!(
env!("CARGO_PKG_VERSION"),
" (verified with Claude Code 2.1.197)"
),
about = "List Claude Code sessions for a folder and its subprojects"
)]
pub struct Cli {
pub path: Option<String>,
#[arg(short = 'g', long)]
pub global: bool,
#[arg(short = 'R', long = "no-recursive")]
pub no_recursive: bool,
#[arg(short = 's', long)]
pub search: Option<String>,
#[arg(long, value_name = "ID_OR_NAME")]
pub show: Option<String>,
#[arg(long, value_name = "UUID", requires = "show")]
pub before: Option<String>,
#[arg(long, value_enum, value_name = "ROLE")]
pub role: Option<Role>,
#[arg(long, value_name = "TEXT")]
pub grep: Option<String>,
#[arg(long)]
pub since: Option<String>,
#[arg(long)]
pub until: Option<String>,
#[arg(long)]
pub period: Option<String>,
#[arg(long, value_enum)]
pub sort: Option<SortKey>,
#[arg(short = 'r', long)]
pub reverse: bool,
#[arg(short = 'n', long)]
pub limit: Option<usize>,
#[arg(long, value_name = "ID", conflicts_with = "show")]
pub after: Option<String>,
#[arg(long)]
pub json: bool,
#[arg(long, hide = true)]
pub projects_dir: Option<String>,
}
#[derive(clap::ValueEnum, Clone, Copy, Debug)]
pub enum Role {
User,
Assistant,
}
impl Role {
pub fn as_str(self) -> &'static str {
match self {
Role::User => "user",
Role::Assistant => "assistant",
}
}
}