art: Move ListOutput under utils

This commit is contained in:
Ettore Di Giacinto
2022-08-18 13:14:12 +00:00
committed by Itxaka
parent 212cf5132a
commit 8518a3752e
2 changed files with 21 additions and 18 deletions

View File

@@ -2,7 +2,6 @@ package github
import (
"context"
"encoding/json"
"fmt"
"log"
"net/http"
@@ -10,7 +9,6 @@ import (
"github.com/google/go-github/v40/github"
"golang.org/x/oauth2"
"gopkg.in/yaml.v1"
)
func newHTTPClient(ctx context.Context, token string) *http.Client {
@@ -49,19 +47,3 @@ func FindReleases(ctx context.Context, token, slug string) ([]string, error) {
}
return versions, nil
}
func ListOutput(rels []string, output string) []string {
switch strings.ToLower(output) {
case "yaml":
d, _ := yaml.Marshal(rels)
return []string{string(d)}
case "json":
d, _ := json.Marshal(rels)
return []string{string(d)}
default:
for _, r := range rels {
fmt.Println(r)
}
return rels
}
}