Skip to content

Commit

Permalink
Disallow using both cron and heartbeat
Browse files Browse the repository at this point in the history
Do not allow sending both cron check-ins and heartbeat check-ins.
It is unclear that an use case for this exists, and with the new
name argument, both would default to being sent for the same
check-in, which wouldn't be meaningful for at least one of them.
  • Loading branch information
unflxw committed Nov 18, 2024
1 parent c7cc139 commit 800bee4
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ pub struct Cli {
///
/// If this option is set, a heartbeat check-in will be sent two times
/// per minute.
#[arg(long, value_name = "IDENTIFIER", requires = "api_key")]
#[arg(long, value_name = "IDENTIFIER", requires = "api_key", conflicts_with = "cron")]
heartbeat: Option<String>,

/// The identifier to use to send cron check-ins.
Expand All @@ -76,7 +76,7 @@ pub struct Cli {
/// process starts, and if the wrapped process finishes with a success
/// exit code, a finish cron check-in will be sent when the process
/// finishes.
#[arg(long, value_name = "IDENTIFIER", requires = "api_key")]
#[arg(long, value_name = "IDENTIFIER", requires = "api_key", conflicts_with = "heartbeat")]
cron: Option<String>,

/// Do not send standard output.
Expand Down Expand Up @@ -472,18 +472,6 @@ mod tests {
#[test]
fn cli_check_in_config() {
for (args, cron, heartbeat) in [
(
vec![
"--cron",
"some-cron",
"--digest",
"some-digest",
"--heartbeat",
"some-heartbeat",
],
true,
true,
),
(
vec!["--cron", "some-cron", "--digest", "some-digest"],
true,
Expand Down

0 comments on commit 800bee4

Please sign in to comment.