last unstarted piece of the original #694 epic. agents kept falling back to curl for 'who closed this?' / 'when was this labelled?' archaeology because view + comments only surface the body + comments, not the structured timeline events (label adds, assignments, closes, reopens, pushes, commit refs, review submissions, milestone changes). separate verb rather than view --timeline because: - composes naturally with view <n> / comments <n> - keeps existing verb output shapes stable (no script breakage) - argus on #770 already noted view's output is busy human-readable by default ('**actor @ ts**: <summary>'), --json for raw piping. unknown event types fall through to a '[<type>]' placeholder so a forge schema bump doesn't panic the verb. --tail N is a follow-up: timeline endpoint doesn't expose a total-count field so the count-then-page strategy from #770 doesn't apply directly. 6 tests cover comment / label add/remove / close / unknown-type placeholder / missing-user fallback.
39 lines
968 B
Rust
39 lines
968 B
Rust
//! Per-verb subcommand modules. Each module exposes a `Args` struct
|
|
//! (clap-derived) and a `run` fn taking `(&Client, Args) -> Result<()>`.
|
|
//! Splitting one verb per module keeps each handler small and avoids
|
|
//! the bash script's monolithic `case` statement.
|
|
|
|
pub mod assign;
|
|
pub mod attach;
|
|
pub mod branches;
|
|
pub mod close;
|
|
pub mod comment;
|
|
pub mod comment_edit;
|
|
pub mod comment_show;
|
|
pub mod comments;
|
|
pub mod diff;
|
|
pub mod issue;
|
|
pub mod issue_create;
|
|
pub mod issue_edit;
|
|
pub mod labels;
|
|
pub mod lint;
|
|
pub mod list;
|
|
pub mod milestone;
|
|
pub mod pr;
|
|
pub mod pr_create;
|
|
pub mod pr_reviews;
|
|
pub mod subscription;
|
|
pub mod timeline;
|
|
pub mod tree_sha;
|
|
pub mod view;
|
|
|
|
use anyhow::Result;
|
|
use serde_json::Value;
|
|
|
|
/// Pretty-print a `serde_json` value to stdout with a trailing newline,
|
|
/// matching the bash script's `| jq` output shape.
|
|
pub(crate) fn print_json(v: &Value) -> Result<()> {
|
|
let s = serde_json::to_string_pretty(v)?;
|
|
println!("{s}");
|
|
Ok(())
|
|
}
|