Skip to content

Fix: Improve CLI error handling and stats value formatting - #122

Merged
thomas-vilte merged 2 commits into
masterfrom
dev
Jul 31, 2026
Merged

thomas-vilte merged 2 commits into
masterfrom
dev

Conversation

@thomas-vilte

@thomas-vilte thomas-vilte commented Jul 31, 2026

Copy link
Copy Markdown
Owner

Description

I improved the CLI error reporting across several commands. Specifically, I added ui.PrintError calls in internal/commands/config/init.go and internal/commands/config/set.go to ensure error messages are displayed to the user before the command exits. In internal/commands/issues/templates.go, I updated error handling to use ui.HandleAppError for a more consistent user experience. Additionally, the templates_already_exist error in internal/services/issue_template_service.go now includes a suggestion to use the --force flag.

I also addressed an issue with the display of monetary and percentage values in the stats command. The internal/commands/stats/stats.go file was modified to format all relevant float values (totals, averages, projections, cache hit rates, saved amounts, and average costs) using fmt.Sprintf("%.4f", value) before they are passed to the i18n templates. This prevents floating-point precision artifacts (e.g., 0.30000000000000004) from appearing in the user-facing output, ensuring clean and consistent numerical presentation.

Fixes # (issue)

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

How Has This Been Tested?

  • Unit tests
  • Integration tests
  • Manual test: (describe below)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Test Plan & Evidence

Suggested Manual Verification

  • API/Backend: Attach JSON response or logs as evidence of correct behavior
  • Performance: Ensure no significant latency increase
  • Unit Tests: Run go test ./... and ensure all tests pass
  • No Regressions: Verify that related features still work as expected

@thomas-vilte thomas-vilte changed the title placeholder Format monetary and percentage values cleanly in stats output Jul 31, 2026
@thomas-vilte thomas-vilte added fix Bug fixes test Testing, trials, and coverage labels Jul 31, 2026
@thomas-vilte thomas-vilte changed the title Format monetary and percentage values cleanly in stats output Fix: Improve CLI error handling and stats value formatting Jul 31, 2026
@thomas-vilte
thomas-vilte merged commit 3040624 into master Jul 31, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Bug fixes test Testing, trials, and coverage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant