Skip to content

Commit

Permalink
update the binary to include the new options
Browse files Browse the repository at this point in the history
  • Loading branch information
nikomatsakis committed Aug 28, 2024
1 parent 2727905 commit eb045dc
Show file tree
Hide file tree
Showing 4 changed files with 114 additions and 17 deletions.
93 changes: 90 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ ignore = "0.4.18"
postgres-types = { version = "0.2.4", features = ["derive"] }
cron = { version = "0.12.0" }
bytes = "1.1.0"
structopt = "0.3.26"

[dependencies.serde]
version = "1"
Expand Down
35 changes: 22 additions & 13 deletions src/bin/project_goals.rs
Original file line number Diff line number Diff line change
@@ -1,24 +1,33 @@
use structopt::StructOpt;
use triagebot::{github::GithubClient, handlers::project_goals};

/// A basic example
#[derive(StructOpt, Debug)]
struct Opt {
/// If specified, no messages are sent.
#[structopt(long)]
dry_run: bool,

/// Goals with an updated within this threshold will not be pinged.
days_threshold: i64,

/// A string like "on Sep-5" when the update blog post will be written.
next_meeting_date: String,
}

#[tokio::main(flavor = "current_thread")]
async fn main() -> anyhow::Result<()> {
dotenv::dotenv().ok();
tracing_subscriber::fmt::init();

let mut dry_run = false;

for arg in std::env::args().skip(1) {
match arg.as_str() {
"--dry-run" => dry_run = true,
_ => {
eprintln!("Usage: project_goals [--dry-run]");
std::process::exit(1);
}
}
}

let opt = Opt::from_args();
let gh = GithubClient::new_from_env();
project_goals::ping_project_goals_owners(&gh, dry_run).await?;
project_goals::ping_project_goals_owners(
&gh,
opt.dry_run,
opt.days_threshold,
&opt.next_meeting_date,
) .await?;

Ok(())
}
2 changes: 1 addition & 1 deletion src/handlers/project_goals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::jobs::Job;
use crate::zulip::to_zulip_id;
use anyhow::Context as _;
use async_trait::async_trait;
use chrono::{DateTime, Datelike, NaiveDate, NaiveDateTime, NaiveTime, Utc};
use chrono::{Datelike, NaiveDate, Utc};
use tracing::{self as log};

use super::Context;
Expand Down

0 comments on commit eb045dc

Please sign in to comment.