feat: scaffold CLI with fetch and render-md subcommands
This commit is contained in:
+41
@@ -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>,
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
pub mod cli;
|
||||
|
||||
pub fn run() -> anyhow::Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
fn main() -> anyhow::Result<()> {
|
||||
gitea_pr_review::run()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user