-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* unify result object and output * add entrypoint flag to run command * add tail flag to logs command
- Loading branch information
Showing
9 changed files
with
70 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package types | ||
|
||
import ( | ||
"github.com/dhenkel92/pod-helper/src/kube" | ||
"github.com/dhenkel92/pod-helper/src/log" | ||
"github.com/logrusorgru/aurora" | ||
v1 "k8s.io/api/core/v1" | ||
"strings" | ||
) | ||
|
||
type Result struct { | ||
ExecResult kube.ExecResult | ||
Pod v1.Pod | ||
} | ||
|
||
func (result *Result) Print() { | ||
var text string | ||
var resText string | ||
if result.ExecResult.Error == nil { | ||
text = aurora.Sprintf(aurora.Green("Success on %s"), result.Pod.Name) | ||
resText = result.ExecResult.StdOut | ||
} else { | ||
text = aurora.Sprintf(aurora.Red("Failed on %s"), result.Pod.Name) | ||
resText = result.ExecResult.StdOut | ||
} | ||
|
||
lineByLine := strings.Split(resText, "\n") | ||
|
||
log.Info.Println("----------------------------------------") | ||
log.Info.Println(text) | ||
log.Info.Printf("Result:\n\n\t%s", strings.Join(lineByLine, "\n\t")) | ||
log.Info.Println("----------------------------------------") | ||
} |