Skip to content

fix: Respect --plain in issue view header - #7

Merged
rethab merged 3 commits into
mainfrom
fix/issue-213
Jul 12, 2026
Merged

fix: Respect --plain in issue view header#7
rethab merged 3 commits into
mainfrom
fix/issue-213

Conversation

@rethab

@rethab rethab commented Jul 12, 2026

Copy link
Copy Markdown
Owner

jira issue view --plain (and non-TTY output that auto-detects plain mode) still leaked non-ASCII decorations into piped output. Parts of the view — separator() and footer() — already branch on Display.Plain, but the rest didn't. Plain output should be safe to pipe, grep, and render in a non-UTF-8 locale like LC_ALL=C, so no decoration the view adds around issue data may be non-ASCII.

Two changes:

  • header() now follows the same pattern as the rest of the view: when Display.Plain is set it renders ASCII labels (Type:, Status:, Assignee:, …) instead of emoji-decorated fields.
  • The remaining decorations go ASCII in plain mode too: subtask, linked-issue, and comment fields are separated by | instead of , and truncated summaries end in ... instead of (shortenAndPad now takes the ellipsis as a parameter and keeps the same column width either way, so alignment is unaffected).

Non-plain output is unchanged. A new test asserts the plain issue view contains no non-ASCII characters at all, so future decorations can't silently regress this; a counterpart test pins that the non-plain view keeps its decorations.

Addresses ankitpokhrel#213.

rethab added 2 commits July 12, 2026 08:40
The header() rendering in issue view unconditionally embedded emoji
glyphs regardless of Display.Plain, so `jira issue view --plain`
still leaked emoji into piped/plain output. Other parts of the same
view (separator, footer) already branch on Display.Plain; header()
now follows the same pattern and uses plain ASCII labels instead of
emoji when Plain is set.
The header was only one of the places that hard-coded non-ascii
decorations. Subtasks, linked issues and comment metadata still
separated their fields with a U+2022 bullet, and long summaries were
truncated with a U+2026 ellipsis, so plain output was not ascii-only
yet and still broke under LC_ALL=C.

Plain mode now uses '|' as the field separator and '...' as the
truncation marker. The ellipsis is measured in runes so both markers
occupy the same column width and existing alignment is preserved.
Non-plain output is unchanged.
shortenAndPad measured the message in bytes, so a multi-byte summary
could be cut mid-rune and produce invalid UTF-8. Measure both the
message and the ellipsis in runes.

Also compute the emoji parent field only on the non-plain path of
header(), where it is actually used.
@rethab
rethab merged commit 12d6daf into main Jul 12, 2026
1 check passed
@rethab
rethab deleted the fix/issue-213 branch July 12, 2026 07:00
rethab added a commit that referenced this pull request Jul 12, 2026
Follow-up to #7, which made the issue view's own decorations ASCII in
plain mode but left the layers underneath it alone. `LC_ALL=C jira issue
view --plain` still emitted characters the locale can't represent,
because plain output is not printed straight from `Issue.String()`: it
is rendered by glamour, and on Jira cloud the description and comments
are translated from ADF before that. Both layers decorate.

Three sources, all of them markup the tool adds around issue data:

- glamour's `notty` style prefixes list items with `•` and suffixes
image alt text with `→`. Its `ascii` style is a byte-for-byte copy of
`notty`, so asking for that style instead does nothing — plain view now
builds the style itself and overrides those two fields.
- the ADF translator marks inline cards with 📍.
- the ADF translator swaps `<` and `>` for the lookalikes `❬`/`❭`,
because the markdown renderer would otherwise consume them as an HTML
tag and drop the text. In ASCII mode it backslash-escapes them instead,
which renders as the original character — so plain output can now be
grepped for `<foo>`, which it couldn't before. Code blocks and inline
code keep the raw brackets, since the renderer prints those verbatim and
an escape would show up as a literal backslash.

Non-plain output is byte-identical: the ADF translator only drops to
ASCII when the view asks it to, which it does when `Display.Plain` is
set.

Checked against real issues in a `LC_ALL=C` shell: where the old binary
emitted six bullets and an `❭`, the new one emits neither. What remains
is the issue text itself — a curly apostrophe someone typed into a
description still prints. Deciding whether to transliterate *content* is
a different question from not decorating it, and I left it alone.

Refs ankitpokhrel#213.
rethab added a commit that referenced this pull request Aug 5, 2026
`jira issue view --plain` (and non-TTY output that auto-detects plain
mode) still leaked non-ASCII decorations into piped output. Parts of the
view — `separator()` and `footer()` — already branch on `Display.Plain`,
but the rest didn't. Plain output should be safe to pipe, grep, and
render in a non-UTF-8 locale like `LC_ALL=C`, so no decoration the view
adds around issue data may be non-ASCII.

Two changes:

- `header()` now follows the same pattern as the rest of the view: when
`Display.Plain` is set it renders ASCII labels (`Type:`, `Status:`,
`Assignee:`, …) instead of emoji-decorated fields.
- The remaining decorations go ASCII in plain mode too: subtask,
linked-issue, and comment fields are separated by `|` instead of `•`,
and truncated summaries end in `...` instead of `…` (`shortenAndPad` now
takes the ellipsis as a parameter and keeps the same column width either
way, so alignment is unaffected).

Non-plain output is unchanged. A new test asserts the plain issue view
contains no non-ASCII characters at all, so future decorations can't
silently regress this; a counterpart test pins that the non-plain view
keeps its decorations.

Addresses ankitpokhrel#213.
rethab added a commit that referenced this pull request Aug 5, 2026
Follow-up to #7, which made the issue view's own decorations ASCII in
plain mode but left the layers underneath it alone. `LC_ALL=C jira issue
view --plain` still emitted characters the locale can't represent,
because plain output is not printed straight from `Issue.String()`: it
is rendered by glamour, and on Jira cloud the description and comments
are translated from ADF before that. Both layers decorate.

Three sources, all of them markup the tool adds around issue data:

- glamour's `notty` style prefixes list items with `•` and suffixes
image alt text with `→`. Its `ascii` style is a byte-for-byte copy of
`notty`, so asking for that style instead does nothing — plain view now
builds the style itself and overrides those two fields.
- the ADF translator marks inline cards with 📍.
- the ADF translator swaps `<` and `>` for the lookalikes `❬`/`❭`,
because the markdown renderer would otherwise consume them as an HTML
tag and drop the text. In ASCII mode it backslash-escapes them instead,
which renders as the original character — so plain output can now be
grepped for `<foo>`, which it couldn't before. Code blocks and inline
code keep the raw brackets, since the renderer prints those verbatim and
an escape would show up as a literal backslash.

Non-plain output is byte-identical: the ADF translator only drops to
ASCII when the view asks it to, which it does when `Display.Plain` is
set.

Checked against real issues in a `LC_ALL=C` shell: where the old binary
emitted six bullets and an `❭`, the new one emits neither. What remains
is the issue text itself — a curly apostrophe someone typed into a
description still prints. Deciding whether to transliterate *content* is
a different question from not decorating it, and I left it alone.

Refs ankitpokhrel#213.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant