Skip to content

Commit 8a95db4

Browse files
committed
Add docs for new output modes
1 parent 0f90f50 commit 8a95db4

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

internal/util/output.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,16 @@ import (
88
"github.com/huangsam/namigo/internal/model"
99
)
1010

11+
// OutputMode represents the output mode.
1112
type OutputMode int
1213

14+
// Output modes.
1315
const (
1416
TextMode OutputMode = iota
1517
JSONMode
1618
)
1719

20+
// String returns the string representation of the output mode.
1821
func (o OutputMode) String() string {
1922
switch o {
2023
case TextMode:
@@ -26,6 +29,7 @@ func (o OutputMode) String() string {
2629
}
2730
}
2831

32+
// PrintResults prints the results based on the output mode.
2933
func PrintResults(results any, label string, format func(any) string, mode OutputMode) {
3034
switch res := results.(type) {
3135
case []model.GoPackageResult:
@@ -47,6 +51,7 @@ func PrintResults(results any, label string, format func(any) string, mode Outpu
4751
}
4852
}
4953

54+
// printResults prints the results based on the output mode.
5055
func printResults[T any](results []T, label string, format func(any) string, mode OutputMode) {
5156
switch mode {
5257
case JSONMode:

0 commit comments

Comments
 (0)