Skip to content

Commit

Permalink
Use explicit matching
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchWand committed Jun 16, 2024
1 parent afca9a7 commit 432acd2
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,13 @@ pub fn handle_socket_message(
.ok_or(CLIError::Parse("Malformed action request."))?;

let id = get_window_id(notif_id, manager)?;
let action = action_id
.parse::<usize>()
.unwrap_or(0);
let action = match action_id {
"default" => 0,
_ => { action_id
.parse::<usize>()
.map_err(|_| CLIError::Parse("Value is not of type usize."))?
}
};
manager.trigger_action_idx(id, action);
}
"show" => {
Expand Down

0 comments on commit 432acd2

Please sign in to comment.