Skip to content

Commit

Permalink
fix: Panic when calling parallel without arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
Nukesor committed Nov 9, 2023
1 parent e9fe591 commit cf2aa07
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions pueue/src/client/display/group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,19 @@ pub fn format_groups(
style: &OutputStyle,
) -> String {
// Get commandline options to check whether we should return the groups as json.
let SubCommand::Group { json, .. } = cli_command else {
panic!("Got wrong Subcommand {cli_command:?} in format_groups. This shouldn't happen.")
let json = match cli_command {
SubCommand::Group { json, .. } => *json,
// If `parallel` is called without an argument, the group info is shown.
SubCommand::Parallel {
parallel_tasks: None,
group: None,
} => false,
_ => {
panic!("Got wrong Subcommand {cli_command:?} in format_groups. This shouldn't happen.")
}
};

if *json {
if json {
return serde_json::to_string(&message.groups).unwrap();
}

Expand Down

0 comments on commit cf2aa07

Please sign in to comment.