From d44ac864609c7c251d8f2459410370e80ff529b7 Mon Sep 17 00:00:00 2001 From: Abel Guzman Sanchez Date: Thu, 29 Feb 2024 12:18:06 +0800 Subject: [PATCH] cleanup-01; README.md, main.go edit the readmy -h text to have -l new option. then remove commented out code from main.go --- README.md | 3 +++ main.go | 29 ----------------------------- 2 files changed, 3 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index c784cff..2f1ffe8 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,7 @@ $ ./kompare -h usage: print [-h|--help] [-c|--conf ""] [-s|--src ""] -t|--target "" [-v|--verbose] [-i|--include ""] [-e|--exclude ""] [-n|--namespace ""] [-f|--filter ""] + [-l|--file ""] Prints provided string to stdout @@ -53,6 +54,8 @@ Arguments: -f --filter Filter what parts of the object I want to compare. must be used together with -i option to apply to that type of objects + -l --file Save the output to a file. If not provided, the output will + be printed to the console. $ ``` diff --git a/main.go b/main.go index a7ad7e8..c57e3b3 100644 --- a/main.go +++ b/main.go @@ -26,35 +26,6 @@ func main() { if args.FileOutput != "" { defer tools.LogOutput(args.FileOutput)() } - // var file *os.File - // if args.FileOutput != "" { - // _, fileString, _ := tools.IsValidPath(args.FileOutput) - // var err error - // file, err = os.Create(fileString) - // if err != nil { - // fmt.Println("Error opening file:", err) - // os.Exit(1) - // } - // defer file.Close() - // } - // // Create a multi-writer to write to both stdout and the file (if specified) - // var writers []io.Writer - // writers = append(writers, os.Stdout) - // if file != nil { - // writers = append(writers, file) - // } - // multiWriter := io.MultiWriter(writers...) - // // Use a goroutine to copy output to both stdout and the file - // go func(out io.Writer) { - // for { - // // Copy output to both stdout and the file - // _, err := io.Copy(out, os.Stdin) - // if err != nil { - // fmt.Println("Error copying output:", err) - // return - // } - // } - // }(multiWriter) // Connect to source cluster clientsetToSource, err := connect.ConnectToSource(args.SourceClusterContext, &args.KubeconfigFile)