Skip to content

fix: enable --show-item-count in non-interactive mode (#431)#495

Merged
dundee merged 2 commits intodundee:masterfrom
ShivamB25:fix/show-item-count-non-interactive-431
Feb 24, 2026
Merged

fix: enable --show-item-count in non-interactive mode (#431)#495
dundee merged 2 commits intodundee:masterfrom
ShivamB25:fix/show-item-count-non-interactive-431

Conversation

@ShivamB25
Copy link
Contributor

Problem

The --show-item-count (-C) flag was not working in non-interactive mode (-n). Item counts were not displayed next to entries, unlike in interactive mode.

Solution

  • Modified stdout/stdout.go to respect the --show-item-count flag in non-interactive output
  • Updated cmd/gdu/app/app.go to properly pass the item count flag to the stdout formatter
  • Added comprehensive test coverage in stdout/stdout_test.go to verify item counts display correctly in non-interactive mode

Testing

All tests pass:

  • golangci-lint run
  • go test -v -covermode=count ./...
  • go test -v -race -covermode=atomic -coverprofile=coverage.out ./...

Closes

Closes #431

@codecov
Copy link

codecov bot commented Feb 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.54%. Comparing base (ede21d2) to head (8379c42).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #495      +/-   ##
==========================================
+ Coverage   81.42%   81.54%   +0.11%     
==========================================
  Files          49       49              
  Lines        5126     5158      +32     
==========================================
+ Hits         4174     4206      +32     
  Misses        816      816              
  Partials      136      136              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ShivamB25
Copy link
Contributor Author

ShivamB25 commented Feb 14, 2026

Addressed the Codecov patch-coverage gaps with targeted tests and pushed commit 8379c42.

What was added:

  • non-interactive app propagation test for --show-item-count (covers createUI() branch in cmd/gdu/app/app.go)
  • stdout color-path test for showItemCnt + UseColors (covers printItem() branch in stdout/stdout.go)

Validation run locally:

  • golangci-lint run
  • go test -v -covermode=count ./...
  • go test -v -race -covermode=atomic -coverprofile=coverage.out ./...

Please re-check Codecov on this latest head.

@dundee dundee self-requested a review February 24, 2026 05:17
@dundee dundee merged commit 305bdf8 into dundee:master Feb 24, 2026
9 checks passed
@ShivamB25 ShivamB25 deleted the fix/show-item-count-non-interactive-431 branch February 24, 2026 17:32
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.

--show-item-count ignored in --non-interactive mode

2 participants