feat(cli, term): Show conversation attachments in jp conversation show#813
Merged
Conversation
`jp conversation show` now lists the attachments associated with a conversation under an "Attachments" field. Each attachment renders as `scheme (description): url` when the URL carries a `description` query parameter, and as the bare URL otherwise. The JSON output serializes each attachment as an object with `scheme`, `description`, and `url` fields. To support list-valued fields in the details view, `jp_term::table` gains three new types: `DetailRow`, `DetailValue`, and `DetailItem`. `DetailRow` replaces the raw `comfy_table::Row` type throughout `print_details`, `details`, `details_markdown`, and `details_json`. A `DetailValue::List` renders as a bulleted block in the pretty terminal view, expands to one row per item in the pipe-delimited markdown view, and becomes a JSON array in the JSON views. The `DetailItem` type lets the text and JSON representations differ so an attachment can read naturally in the terminal while still being structured in JSON. `DetailsFmt` in `jp_cli` gains an `attachments` field and a `with_attachments` builder method, and the `attachment_detail_item` helper in `jp_cli::format` constructs the right `DetailItem` from any attachment URL. Signed-off-by: Jean Mertz <git@jeanmertz.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
jp conversation shownow lists the attachments associated with a conversation under an "Attachments" field. Each attachment renders asscheme (description): urlwhen the URL carries adescriptionquery parameter, and as the bare URL otherwise. The JSON output serializes each attachment as an object withscheme,description, andurlfields.To support list-valued fields in the details view,
jp_term::tablegains three new types:DetailRow,DetailValue, andDetailItem.DetailRowreplaces the rawcomfy_table::Rowtype throughoutprint_details,details,details_markdown, anddetails_json. ADetailValue::Listrenders as a bulleted block in the pretty terminal view, expands to one row per item in the pipe-delimited markdown view, and becomes a JSON array in the JSON views. TheDetailItemtype lets the text and JSON representations differ so an attachment can read naturally in the terminal while still being structured in JSON.DetailsFmtinjp_cligains anattachmentsfield and awith_attachmentsbuilder method, and theattachment_detail_itemhelper injp_cli::formatconstructs the rightDetailItemfrom any attachment URL.