Repository navigation
feat(table): paint columns by style and rules - #24
Merged
Merged
Conversation
Add what api-kit painted itself to the packages it uses:
- table.WithColumnStyles paints the cells of each column of a painted
table, line by line: a style for cells the program did not paint, and
theme.Rules on every cell. Links in a cell stay.
- table.Palette and table.NewPalette hold the colors of a listing,
changed through <prefix>_COLOR_TABLE_* environment variables.
- theme.Rules paints text with a sequence of whole-text and pattern
rules; theme.HasColor tells painted text from plain.
- format.Ago words an age ("5 minutes ago", "3 hours from now"), and
format.ParseTimestamp reads a point in time as APIs write it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.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.
Moves the generic table painting of api-kit into cli-kit, so api-kit only maps its definition onto it.
table.WithColumnStyles(...table.ColumnStyle)paints the cells of each column of a painted table, line by line:Stylefor cells that carry no colors of their own (a cell the program painted, such as a fresh age, keeps its colors), thenRuleson every cell. Links in a cell stay. Markdown and records are never painted.table.Paletteandtable.NewPalette(getenv, prefix)hold the colors of a listing, changed through<prefix>_COLOR_TABLE_HEADER,_COLOR_TABLE_COLUMN_1…_6,_TEXT_COLOR_DURATIONand_TEXT_DURATION_FRESH.theme.Rulespaints text with whole-text and pattern rules in turn; a whole-text rule takes out earlier colors but keeps links.theme.HasColortells painted text from plain.format.Agowords an age ("5 minutes ago", "3 hours from now");format.ParseTimestampreads RFC 3339 timestamps with seconds and a zone, offsets checked for range.🤖 Generated with Claude Code