Skip to content

Commit

Permalink
Merge pull request #527 from hazelops/IZE-689-ize-gen-shows-git-statu…
Browse files Browse the repository at this point in the history
…s-when-executing

IZE-689 hide git output
  • Loading branch information
psihachina authored Nov 4, 2022
2 parents d67a063 + 0362b0b commit ba7f5dd
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions internal/generate/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (

"github.com/hazelops/ize/examples"
pp "github.com/psihachina/path-parser"
"github.com/sirupsen/logrus"

"github.com/go-git/go-git/v5"
"github.com/go-git/go-git/v5/plumbing/transport/ssh"
Expand Down Expand Up @@ -53,6 +54,11 @@ func GetDataFromFile(source, template string) ([]byte, error) {

defer os.RemoveAll(dir) // clean up

wr := io.Discard
if logrus.GetLevel() == logrus.DebugLevel {
wr = os.Stdout
}

if o.Protocol == "ssh" {
privateKeyFile := filepath.Join(os.Getenv("HOME"), ".ssh", "id_rsa")

Expand All @@ -66,7 +72,7 @@ func GetDataFromFile(source, template string) ([]byte, error) {
Auth: publicKeys,
URL: source,
Depth: 1,
Progress: os.Stdout,
Progress: wr,
},
)
if err != nil {
Expand All @@ -77,7 +83,7 @@ func GetDataFromFile(source, template string) ([]byte, error) {
&git.CloneOptions{
URL: source,
Depth: 1,
Progress: os.Stdout,
Progress: wr,
},
)
if err != nil {
Expand Down

0 comments on commit ba7f5dd

Please sign in to comment.