feat: scaffold CLI with fetch and render-md subcommands

This commit is contained in:
2026-04-08 22:46:33 +08:00
parent 1b5c8619d6
commit 0ce8786148
6 changed files with 270 additions and 2 deletions
+41
View File
@@ -0,0 +1,41 @@
use clap::{Parser, Subcommand, ValueEnum};
use std::path::PathBuf;
#[derive(Debug, Clone, Copy, PartialEq, Eq, ValueEnum)]
pub enum OutputFormat {
Markdown,
Json,
}
#[derive(Debug, Parser)]
#[command(name = "gitea-pr-review")]
pub struct Cli {
#[command(subcommand)]
pub command: Commands,
}
#[derive(Debug, Subcommand)]
pub enum Commands {
Fetch(FetchArgs),
RenderMd(RenderMdArgs),
}
#[derive(Debug, clap::Args)]
pub struct FetchArgs {
pub pr_index: i64,
#[arg(long, value_enum, default_value_t = OutputFormat::Markdown)]
pub format: OutputFormat,
#[arg(long)]
pub out: Option<PathBuf>,
}
#[derive(Debug, clap::Args)]
pub struct RenderMdArgs {
#[arg(long = "in")]
pub input: PathBuf,
#[arg(long)]
pub out: Option<PathBuf>,
}
+5
View File
@@ -0,0 +1,5 @@
pub mod cli;
pub fn run() -> anyhow::Result<()> {
Ok(())
}
+2 -2
View File
@@ -1,3 +1,3 @@
fn main() {
println!("Hello, world!");
fn main() -> anyhow::Result<()> {
gitea_pr_review::run()
}