From 7316c68bd6756ef40873094c1b2a8b61c056020f Mon Sep 17 00:00:00 2001 From: Francesco Guardiani Date: Wed, 20 Nov 2024 14:12:00 +0100 Subject: [PATCH] Don't show completed invocations by default (#2318) * Don't show completed invocations by default * Add --all flag --- cli/src/commands/invocations/list.rs | 11 ++++++++++- cli/src/commands/invocations/mod.rs | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/cli/src/commands/invocations/list.rs b/cli/src/commands/invocations/list.rs index 4747d1b3f..df26d0981 100644 --- a/cli/src/commands/invocations/list.rs +++ b/cli/src/commands/invocations/list.rs @@ -35,6 +35,9 @@ pub struct List { /// Filter by invocation on this handler name #[clap(long, value_delimiter = ',')] handler: Vec, + /// Show all invocations, including the completed ones that are hidden by default. This overrides the `status` filter. + #[clap(long)] + all: bool, /// Filter by status(es) #[clap(long, ignore_case = true, value_delimiter = ',')] status: Vec, @@ -117,7 +120,13 @@ async fn list(env: &CliEnv, opts: &List) -> Result<()> { } // This is a post-filter as we filter by calculated column - if !statuses.is_empty() { + if opts.all { + // No filter + } else if statuses.is_empty() { + // Default hide completed invocations + post_filters.push("status != 'completed'".to_owned()); + } else { + // Apply status filters post_filters.push(format!( "status IN ({})", statuses.iter().map(|x| format!("'{}'", x)).format(",") diff --git a/cli/src/commands/invocations/mod.rs b/cli/src/commands/invocations/mod.rs index fc70ec8da..0250a4999 100644 --- a/cli/src/commands/invocations/mod.rs +++ b/cli/src/commands/invocations/mod.rs @@ -17,7 +17,7 @@ use cling::prelude::*; #[derive(Run, Subcommand, Clone)] pub enum Invocations { - /// List invocations of a service + /// List invocations List(list::List), /// Prints detailed information about a given invocation Describe(describe::Describe),