Skip to content

Commit

Permalink
factor the updates command out
Browse files Browse the repository at this point in the history
  • Loading branch information
Niko Matsakis committed Dec 13, 2024
1 parent d584390 commit cb40881
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions crates/rust-project-goals-cli-llm/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use clap::Parser;
use rust_project_goals::gh::issue_id::Repository;
use rust_project_goals_llm::Updates;
use rust_project_goals_llm::UpdateArgs;

mod llm;
mod templates;
Expand All @@ -19,7 +19,7 @@ struct Opt {
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let Opt { repository, updates_json } = Opt::parse();
let Updates { milestone, quick, vscode, output_file, start_date, end_date, model_id, region } =
let UpdateArgs { milestone, quick, vscode, output_file, start_date, end_date, model_id, region } =
&serde_json::from_str(&updates_json)?;
updates::updates(&repository, milestone, output_file.as_deref(), start_date, end_date, *quick, *vscode, model_id.as_deref(), region.as_deref()).await?;
Ok(())
Expand Down
2 changes: 1 addition & 1 deletion crates/rust-project-goals-cli-llm/src/templates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub struct Templates<'h> {

impl<'h> Templates<'h> {
pub fn new() -> anyhow::Result<Self> {
let templates = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../templates");
let templates = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../../templates");
Self::from_templates_dir(&templates)
}

Expand Down
4 changes: 2 additions & 2 deletions crates/rust-project-goals-cli/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use anyhow::{bail, Context};
use clap::Parser;
use regex::Regex;
use rust_project_goals_llm::Updates;
use rust_project_goals_llm::UpdateArgs;
use std::path::PathBuf;
use walkdir::WalkDir;
use rust_project_goals::gh::issue_id::Repository;
Expand Down Expand Up @@ -74,7 +74,7 @@ enum Command {
/// Collects updates
Updates {
#[command(flatten)]
updates: Updates
updates: UpdateArgs
},
}

Expand Down
2 changes: 1 addition & 1 deletion crates/rust-project-goals-llm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use serde::{Serialize, Deserialize};

/// Updates struct
#[derive(clap::Args, Debug, Serialize, Deserialize)]
pub struct Updates {
pub struct UpdateArgs {
/// Milestone for which we generate tracking issue data (e.g., `2024h2`).
pub milestone: String,

Expand Down

0 comments on commit cb40881

Please sign in to comment.