mirror of
https://github.com/kairos-io/kairos-agent.git
synced 2025-09-01 01:03:52 +00:00
art: Move ListOutput under utils
This commit is contained in:
committed by
Itxaka
parent
212cf5132a
commit
8518a3752e
@@ -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
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user