diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2026-03-04 13:28:30 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2026-03-04 13:28:30 +0000 |
| commit | 3908abbbfc5e748dd168d22bf5e3ea6aae17de61 (patch) | |
| tree | 7d16390d57f8a7399212ebc30e6524ed25da1db6 /src/lib/client.rs | |
| parent | a554da3ec0bdfef648921fda41f38ad0a5d53d27 (diff) | |
feat: add ngit issue list command
Non-interactive listing of NIP-34 issues (kind 1621) with status
resolution, hashtag display, and detail view.
- get_issues_from_cache: fetch GitIssue events from local cache by repo
coordinate, mirroring get_proposals_and_revisions_from_cache
- ngit issue list: table output of ID, status, title and hashtags at end
of each row; status resolved via existing get_status() logic
- --status: comma-separated filter (open,draft,closed,applied; default: open)
- --hashtag: comma-separated label filter (case-insensitive, OR match)
- --json: machine-readable output including hashtags and description
- --offline: skip network fetch, use local cache only
- <id>: optional positional argument (hex event-id or nevent) to show
full details of a specific issue including body content
Diffstat (limited to 'src/lib/client.rs')
| -rw-r--r-- | src/lib/client.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/lib/client.rs b/src/lib/client.rs index 62db8d2..1f46e3c 100644 --- a/src/lib/client.rs +++ b/src/lib/client.rs | |||
| @@ -2505,6 +2505,30 @@ pub async fn fetching_quietly( | |||
| 2505 | Ok((report, had_errors)) | 2505 | Ok((report, had_errors)) |
| 2506 | } | 2506 | } |
| 2507 | 2507 | ||
| 2508 | pub async fn get_issues_from_cache( | ||
| 2509 | git_repo_path: &Path, | ||
| 2510 | repo_coordinates: HashSet<Nip19Coordinate>, | ||
| 2511 | ) -> Result<Vec<nostr::Event>> { | ||
| 2512 | let mut issues = get_events_from_local_cache( | ||
| 2513 | git_repo_path, | ||
| 2514 | vec![ | ||
| 2515 | nostr::Filter::default() | ||
| 2516 | .kinds([nostr::Kind::GitIssue]) | ||
| 2517 | .custom_tags( | ||
| 2518 | nostr::SingleLetterTag::lowercase(nostr_sdk::Alphabet::A), | ||
| 2519 | repo_coordinates | ||
| 2520 | .iter() | ||
| 2521 | .map(|c| c.coordinate.to_string()) | ||
| 2522 | .collect::<Vec<String>>(), | ||
| 2523 | ), | ||
| 2524 | ], | ||
| 2525 | ) | ||
| 2526 | .await?; | ||
| 2527 | issues.sort_by_key(|e| e.created_at); | ||
| 2528 | issues.reverse(); | ||
| 2529 | Ok(issues) | ||
| 2530 | } | ||
| 2531 | |||
| 2508 | pub async fn get_proposals_and_revisions_from_cache( | 2532 | pub async fn get_proposals_and_revisions_from_cache( |
| 2509 | git_repo_path: &Path, | 2533 | git_repo_path: &Path, |
| 2510 | repo_coordinates: HashSet<Nip19Coordinate>, | 2534 | repo_coordinates: HashSet<Nip19Coordinate>, |