Demo: missing CLI args can be filled via env vars

This commit is contained in:
2025-05-24 19:00:35 -05:00
parent 985c411902
commit 1210b168ee
2 changed files with 5 additions and 5 deletions

View File

@@ -4,7 +4,7 @@ version = "0.1.0"
edition = "2024"
[dependencies]
clap = { version = "4.0.7", features = ["derive"] }
clap = { version = "4.0.7", features = ["derive", "env"] }
reqwest = { version = "0.11.13", features = ["json"] }
serde = { version = "1.0.152", features = ["derive"] }
tokio = { version = "1.24.2", features = ["macros", "rt-multi-thread"] }

View File

@@ -3,10 +3,10 @@ use clap::{Parser, Subcommand};
#[derive(Debug, Parser)]
#[command(version, about, long_about = None)]
pub struct Args {
#[arg(short = 'o', long = "owner")]
pub repo_owner: Option<String>,
#[arg(short = 'n', long = "repo_name")]
pub repo_name: Option<String>,
#[arg(short = 'o', long = "owner", env = "GTTOOL_OWNER")]
pub owner: String,
#[arg(short = 'r', long = "repo")]
pub repo: Option<String>,
#[command(subcommand)]
pub command: Commands,