feat(cli): add path & limit to session list command (#4878)

This commit is contained in:
Robert Mcgregor
2025-10-01 00:12:15 +10:00
committed by GitHub
parent 4d17c98334
commit 114a3b31cb
3 changed files with 38 additions and 16 deletions
+14 -8
View File
@@ -98,9 +98,6 @@ fn parse_key_val(s: &str) -> Result<(String, String), String> {
enum SessionCommand {
#[command(about = "List all available sessions")]
List {
#[arg(short, long, help = "List all available sessions")]
verbose: bool,
#[arg(
short,
long,
@@ -115,6 +112,16 @@ enum SessionCommand {
long_help = "Sort sessions by date in ascending order (oldest first). Default is descending order (newest first)."
)]
ascending: bool,
#[arg(
short = 'p',
long = "working_dir",
help = "Filter sessions by working directory"
)]
working_dir: Option<PathBuf>,
#[arg(short = 'l', long = "limit", help = "Limit the number of results")]
limit: Option<usize>,
},
#[command(about = "Remove sessions. Runs interactively if no ID or regex is provided.")]
Remove {
@@ -182,11 +189,9 @@ enum SchedulerCommand {
/// ID of the schedule
#[arg(long, help = "ID of the schedule")] // Explicitly make it --id
id: String,
/// Maximum number of sessions to return
#[arg(long, help = "Maximum number of sessions to return")]
limit: Option<u32>,
limit: Option<usize>,
},
/// Run a scheduled job immediately
#[command(about = "Run a scheduled job immediately")]
RunNow {
/// ID of the schedule to run
@@ -795,11 +800,12 @@ pub async fn cli() -> Result<()> {
}) => {
return match command {
Some(SessionCommand::List {
verbose,
format,
ascending,
working_dir,
limit,
}) => {
handle_session_list(verbose, format, ascending).await?;
handle_session_list(format, ascending, working_dir, limit).await?;
Ok(())
}
Some(SessionCommand::Remove { id, regex }) => {