Skip to content

cleanup the root.go file #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 15, 2025
Merged

cleanup the root.go file #19

merged 3 commits into from
Apr 15, 2025

Conversation

GrantBirki
Copy link
Member

@GrantBirki GrantBirki commented Apr 15, 2025

resolves: #18

@Copilot Copilot AI review requested due to automatic review settings April 15, 2025 00:25
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR cleans up the root.go file by refactoring output-related functions into a dedicated output.go file and adding corresponding tests.

  • Moved display functions (table, JSON, plain) along with helper functions (pad, truncate) from root.go to output.go.
  • Removed unused imports from root.go.
  • Added test cases in output_test.go to cover the new output functions.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
internal/cmd/root.go Removed output formatting functions and cleaned up unused imports.
internal/cmd/output.go Added output functions and helper methods for table, JSON, and plain views.
internal/cmd/output_test.go Added basic tests for the output functions.
Comments suppressed due to low confidence (2)

internal/cmd/output.go:164

  • The error returned by json.MarshalIndent is silently ignored. Consider handling the error to avoid unexpected behavior in case of marshaling failures.
jsonData, _ := json.MarshalIndent(output, "", "  " )

internal/cmd/output_test.go:39

  • The tests call the display functions but lack assertions to verify expected output. Consider capturing the output (e.g., by redirecting stdout) and asserting on its content.
displayTableStats(stats)

@GrantBirki GrantBirki merged commit 88b5dd2 into main Apr 15, 2025
3 checks passed
@GrantBirki GrantBirki deleted the root-cleanup branch April 15, 2025 00:36
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.

cleanup root.go
1 participant