Skip to content

feat: improve list output to match container tool conventions - #40

Merged
pavelanni merged 3 commits into
mainfrom
feature/list-output-formatting
May 1, 2026
Merged

pavelanni merged 3 commits into
mainfrom
feature/list-output-formatting

Conversation

@pavelanni

@pavelanni pavelanni commented May 1, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Strip sha256: prefix from digest column, show 12 hex chars (matching Docker/Podman conventions)
  • Humanize timestamps ("2 days ago" instead of 2026-04-29T22:07:29Z) using dustin/go-humanize
  • Add --no-trunc flag to preserve full digest and raw RFC 3339 timestamps for scripting

Closes #23

Test plan

  • TestFormatDigest — 6 subtests: prefix stripping, other algorithms, short digest, no prefix, no-trunc, empty
  • TestFormatCreated — 4 subtests: no-trunc, empty, unparseable fallback, recent relative time
  • make lint passes
  • Smoke test: skillctl list and skillctl list --no-trunc

Summary by CodeRabbit

  • New Features
    • Added --no-trunc flag to the list command for controlling output format details. By default, image digest hashes are truncated and creation timestamps are displayed in a human-readable format. Using --no-trunc displays the complete digest hash and raw RFC3339 timestamps for advanced troubleshooting and workflows.

pavelanni added 2 commits May 1, 2026 19:43
formatDigest strips the algo: prefix and truncates to 12 chars.
formatCreated renders relative time using go-humanize.
Both accept a noTrunc flag to preserve raw values.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Pavel Anni <[email protected]>
Default output now strips the sha256: prefix from digests and
shows relative timestamps. Use --no-trunc for raw values.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Pavel Anni <[email protected]>
@coderabbitai

coderabbitai Bot commented May 1, 2026 •

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: 6d16480d-c77c-4355-880d-086009bce3ca

📥 Commits

Reviewing files that changed from the base of the PR and between 994dc6f and 6564d11.

📒 Files selected for processing (3)
  • go.mod
  • internal/cli/list.go
  • internal/cli/list_test.go

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to data retention organization setting


📝 Walkthrough

Walkthrough

This PR implements a --no-trunc flag for the list command, allowing users to control whether digest and created timestamp fields are humanized and truncated (default) or shown in full raw format. The go-humanize library is promoted to a direct dependency, and two formatting helpers with comprehensive test coverage are added.

Changes

List Output Formatting with --no-trunc Flag

Layer / File(s) Summary
Dependency
go.mod
github.com/dustin/go-humanize v1.0.1 promoted from indirect to direct dependency for timestamp humanization.
Flag Definition
internal/cli/list.go
--no-trunc boolean flag added to newListCmd; RunE callback updated to pass flag to runList.
Core Formatters
internal/cli/list.go
formatDigest strips algorithm prefix and truncates to 12 chars (or returns full digest if noTrunc); formatCreated humanizes RFC3339 timestamps or returns raw value if noTrunc.
List Wiring
internal/cli/list.go
runList function signature updated to accept noTrunc parameter; DIGEST and CREATED columns now use new formatters.
Tests
internal/cli/list_test.go
TestFormatDigest validates prefix stripping, truncation, and noTrunc behavior; TestFormatCreated validates humanization, raw passthrough, and parse error handling.

Estimated Code Review Effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/list-output-formatting

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 60 minutes.

Comment @coderabbitai help to get the list of available commands and usage tips.

Covers the len(digest) > 12 boundary condition.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Pavel Anni <[email protected]>
@pavelanni
pavelanni marked this pull request as ready for review May 1, 2026 23:51
@pavelanni
pavelanni merged commit 342a9e8 into main May 1, 2026
5 checks passed
@pavelanni
pavelanni deleted the feature/list-output-formatting branch May 1, 2026 23:51
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.

feat: improve list output to match container tool conventions

1 participant