fix: use markdown key-value tables for view commands instead of JSON code fences #2

Merged
ph merged 1 commit from fix/issue-1-print-json-to-markdown into master 2026-06-06 03:04:54 +00:00
Owner

Summary

Fixes #1 — all view commands now render human-readable markdown key-value tables by default, instead of JSON wrapped in code fences. The --json flag still outputs the full API JSON response.

Changes

Core (src/output.rs)

  • Added DetailRow struct (key-value pair with Tabled + Serialize)
  • Added print_detail() method — renders markdown table (default) or JSON (--json)

Fixed commands (12 files)

Command Fields displayed
issue view #, Title, State, Author, Created, Updated, Labels, Assignees, Milestone, Body, URL
pr view #, Title, State, Author, Created, Updated, Head, Base, Labels, Assignees, Merged, Body, URL
comment view ID, Author, Created, Updated, Body, URL
review view ID, Reviewer, State, Submitted, Body, URL
notification view ID, Type, Title, Repository, Unread, Pinned, Updated, URL
user view Login, Full Name, Email, Created, Last Login, Admin, Location, Website, Description, Followers, Following
release view ID, Tag, Name, Draft, Prerelease, Author, Created, Published, Body, URL
release attachment view ID, Name, Size, Downloads, Created, URL
issue-attachment view ID, Name, Size, Downloads, Created, URL
comment-attachment view ID, Name, Size, Downloads, Created, URL
branch-protection view Rule Name, Enable Push, Enable Status Check, Enable Approvals Whitelist, Required Approvals, Created, Updated
workflow view ID, Run #, Status, Event, Commit, Branch, Created, Started, Stopped, Duration, URL

Before / After

Before:

```json
{"id":30,"number":1,"title":"...","body":"...","state":"open"}
```

After:

| Field | Value |
|-------|-------|
| #     | #1    |
| Title | [BUG] ... |
| State | open  |

Notes

  • Mutation commands (create/update/delete) still use print_json — these are lower priority for markdown rendering since they show confirmation output
  • All existing tests pass
  • --json output is unchanged (full API JSON)
## Summary Fixes #1 — all `view` commands now render human-readable markdown key-value tables by default, instead of JSON wrapped in code fences. The `--json` flag still outputs the full API JSON response. ## Changes ### Core (`src/output.rs`) - Added `DetailRow` struct (key-value pair with `Tabled` + `Serialize`) - Added `print_detail()` method — renders markdown table (default) or JSON (`--json`) ### Fixed commands (12 files) | Command | Fields displayed | |---------|-----------------| | `issue view` | #, Title, State, Author, Created, Updated, Labels, Assignees, Milestone, Body, URL | | `pr view` | #, Title, State, Author, Created, Updated, Head, Base, Labels, Assignees, Merged, Body, URL | | `comment view` | ID, Author, Created, Updated, Body, URL | | `review view` | ID, Reviewer, State, Submitted, Body, URL | | `notification view` | ID, Type, Title, Repository, Unread, Pinned, Updated, URL | | `user view` | Login, Full Name, Email, Created, Last Login, Admin, Location, Website, Description, Followers, Following | | `release view` | ID, Tag, Name, Draft, Prerelease, Author, Created, Published, Body, URL | | `release attachment view` | ID, Name, Size, Downloads, Created, URL | | `issue-attachment view` | ID, Name, Size, Downloads, Created, URL | | `comment-attachment view` | ID, Name, Size, Downloads, Created, URL | | `branch-protection view` | Rule Name, Enable Push, Enable Status Check, Enable Approvals Whitelist, Required Approvals, Created, Updated | | `workflow view` | ID, Run #, Status, Event, Commit, Branch, Created, Started, Stopped, Duration, URL | ## Before / After **Before:** ```` ```json {"id":30,"number":1,"title":"...","body":"...","state":"open"} ``` ```` **After:** ``` | Field | Value | |-------|-------| | # | #1 | | Title | [BUG] ... | | State | open | ``` ## Notes - Mutation commands (create/update/delete) still use `print_json` — these are lower priority for markdown rendering since they show confirmation output - All existing tests pass - `--json` output is unchanged (full API JSON)
fix: use markdown key-value tables for view commands instead of JSON code fences
Some checks failed
CI / test (pull_request) Has been cancelled
b355647295
All 12 view commands now use Output::print_detail() which renders a
human-readable markdown table by default, while preserving full JSON
output when --json is set.

- Add DetailRow struct and print_detail() method to Output
- Fix issue view, pr view, comment view, review view, notification view,
  user view, release view, release attachment view, issue-attachment view,
  comment-attachment view, branch-protection view, workflow view

Closes #1
ph merged commit 0dc6133c65 into master 2026-06-06 03:04:54 +00:00
ph deleted branch fix/issue-1-print-json-to-markdown 2026-06-06 03:04:54 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ph/fj!2
No description provided.