mirror of
https://github.com/grdl/git-get.git
synced 2026-02-04 15:39:46 +00:00
Refactor package print into out to fix failing predeclared linter
This commit is contained in:
11
pkg/list.go
11
pkg/list.go
@@ -5,7 +5,7 @@ import (
|
||||
"fmt"
|
||||
"git-get/pkg/cfg"
|
||||
"git-get/pkg/git"
|
||||
"git-get/pkg/print"
|
||||
"git-get/pkg/out"
|
||||
"strings"
|
||||
)
|
||||
|
||||
@@ -27,18 +27,19 @@ func List(conf *ListCfg) error {
|
||||
|
||||
statuses := finder.LoadAll(conf.Fetch)
|
||||
|
||||
printables := make([]print.Printable, len(statuses))
|
||||
printables := make([]out.Printable, len(statuses))
|
||||
|
||||
for i := range statuses {
|
||||
printables[i] = statuses[i]
|
||||
}
|
||||
|
||||
switch conf.Output {
|
||||
case cfg.OutFlat:
|
||||
fmt.Print(print.NewFlatPrinter().Print(printables))
|
||||
fmt.Print(out.NewFlatPrinter().Print(printables))
|
||||
case cfg.OutTree:
|
||||
fmt.Print(print.NewTreePrinter().Print(conf.Root, printables))
|
||||
fmt.Print(out.NewTreePrinter().Print(conf.Root, printables))
|
||||
case cfg.OutDump:
|
||||
fmt.Print(print.NewDumpPrinter().Print(printables))
|
||||
fmt.Print(out.NewDumpPrinter().Print(printables))
|
||||
default:
|
||||
return fmt.Errorf("%w, allowed values: [%s]", ErrInvalidOutput, strings.Join(cfg.AllowedOut, ", "))
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package print
|
||||
package out
|
||||
|
||||
import (
|
||||
"strings"
|
||||
@@ -1,4 +1,4 @@
|
||||
package print
|
||||
package out
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
@@ -1,5 +1,5 @@
|
||||
// Package print implements different outputs for git-list command
|
||||
package print
|
||||
// Package out implements different outputs for git-list command
|
||||
package out
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
@@ -1,4 +1,4 @@
|
||||
package print
|
||||
package out
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
Reference in New Issue
Block a user