Skip to content

Commit

Permalink
Don't show completed invocations by default (restatedev#2318)
Browse files Browse the repository at this point in the history
* Don't show completed invocations by default

* Add --all flag
  • Loading branch information
slinkydeveloper authored Nov 20, 2024
1 parent bf0685d commit 7316c68
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion cli/src/commands/invocations/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ pub struct List {
/// Filter by invocation on this handler name
#[clap(long, value_delimiter = ',')]
handler: Vec<String>,
/// 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<InvocationState>,
Expand Down Expand Up @@ -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(",")
Expand Down
2 changes: 1 addition & 1 deletion cli/src/commands/invocations/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit 7316c68

Please sign in to comment.