Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cli): Split diff and non-diff output #537

Merged
merged 1 commit into from
Mar 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/kubernetes/client/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func (k Kubectl) Delete(namespace, kind, name string, opts DeleteOpts) error {
}

cmd := k.ctl("delete", argv...)
cmd.Stdout = os.Stdout
cmd.Stdout = os.Stderr
cmd.Stderr = os.Stderr
cmd.Stdin = os.Stdin

Expand Down
11 changes: 6 additions & 5 deletions pkg/tanka/prune.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package tanka

import (
"fmt"
"log"

"github.com/fatih/color"

Expand Down Expand Up @@ -40,7 +41,7 @@ func Prune(baseDir string, opts PruneOpts) error {
}

if len(orphaned) == 0 {
fmt.Println("Nothing found to prune.")
log.Println("Nothing found to prune.")
return nil
}

Expand All @@ -61,12 +62,12 @@ func Prune(baseDir string, opts PruneOpts) error {
}
}
if len(namespaces) > 0 {
warning := color.New(color.FgHiYellow, color.Bold).PrintFunc()
warning("WARNING: This will delete following namespaces and all resources in them:\n")
warning := color.New(color.FgHiYellow, color.Bold).FprintfFunc()
warning(color.Error, "WARNING: This will delete following namespaces and all resources in them:\n")
for _, ns := range namespaces {
fmt.Printf(" - %s\n", ns)
log.Printf(" - %s\n", ns)
}
fmt.Println("")
log.Println("")
}

// prompt for confirm
Expand Down
3 changes: 2 additions & 1 deletion pkg/tanka/workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package tanka

import (
"fmt"
"log"

"github.com/fatih/color"

Expand Down Expand Up @@ -45,7 +46,7 @@ func Apply(baseDir string, opts ApplyOpts) error {
switch {
case err != nil:
// This is not fatal, the diff is not strictly required
fmt.Println("Error diffing:", err)
log.Println("Error diffing:", err)
case diff == nil:
tmp := "Warning: There are no differences. Your apply may not do anything at all."
diff = &tmp
Expand Down