hive-forge: make --json a global flag (closes #421)
This commit is contained in:
parent
3cd9240594
commit
d0a1ee037b
5 changed files with 33 additions and 16 deletions
|
|
@ -35,6 +35,12 @@ struct Cli {
|
|||
/// positional the bash helper used.
|
||||
#[arg(short = 'r', long, global = true)]
|
||||
repo: Option<String>,
|
||||
/// Emit JSON output instead of the verb's default human-readable
|
||||
/// shape, for verbs that support both (closes #421). Verbs whose
|
||||
/// only output is already JSON (`issue`, `pr`, etc.) ignore this
|
||||
/// flag — they always print JSON regardless.
|
||||
#[arg(long, global = true)]
|
||||
json: bool,
|
||||
#[command(subcommand)]
|
||||
verb: Verb,
|
||||
}
|
||||
|
|
@ -87,7 +93,8 @@ enum Verb {
|
|||
|
||||
fn main() -> Result<()> {
|
||||
let cli = Cli::parse();
|
||||
let client = client::Client::from_env(cli.repo).context("initialize forge client")?;
|
||||
let client =
|
||||
client::Client::from_env(cli.repo, cli.json).context("initialize forge client")?;
|
||||
match cli.verb {
|
||||
Verb::View(a) => verbs::view::run(&client, a),
|
||||
Verb::Issue(a) => verbs::issue::run(&client, a),
|
||||
|
|
|
|||
Loading…
Reference in a new issue