From 38429705aa8f10c0da0e20d2c868dc85c16e7947 Mon Sep 17 00:00:00 2001 From: Cyrus Javan Date: Fri, 8 Jan 2021 11:58:18 -0800 Subject: [PATCH] change default --- cmd/export.go | 8 ++++---- cmd/root.go | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cmd/export.go b/cmd/export.go index 77ba66b..3fc0745 100644 --- a/cmd/export.go +++ b/cmd/export.go @@ -12,7 +12,7 @@ import ( "github.com/spf13/cobra" ) -var WriteToStdOut bool +var WriteToFile bool var IncludeShellFile bool var exportCmd = &cobra.Command{ @@ -23,8 +23,8 @@ var exportCmd = &cobra.Command{ } func exportFunc(cmd *cobra.Command, args []string) error { - if len(args) == 1 && !WriteToStdOut { - return fmt.Errorf("if flag (--use-stdout, -s) is not set then a path must be provided as the second argument") + if len(args) == 2 && !WriteToFile { + return fmt.Errorf("if flag (--file, -f) is not set then a path must not be provided as the second argument") } client, err := getClient() @@ -77,7 +77,7 @@ func exportFunc(cmd *cobra.Command, args []string) error { if err != nil { return fmt.Errorf("reading zipped file: %v", err) } - if WriteToStdOut { + if !WriteToFile { _, _ = fmt.Fprint(cmd.OutOrStdout(), string(unzippedFileBytes)) } else { tfFilePath := args[1] diff --git a/cmd/root.go b/cmd/root.go index 2072b85..e575f99 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -36,7 +36,7 @@ func init() { rpcCmd.PersistentFlags().BoolVarP(&JsonOnly, "json-only", "j", false, "json response only output") rootCmd.AddCommand(rpcCmd) rootCmd.AddCommand(loginCmd) - exportCmd.PersistentFlags().BoolVarP(&WriteToStdOut, "use-stdout", "s", false, "write output to stdout instead of file") + exportCmd.PersistentFlags().BoolVarP(&WriteToFile, "file", "f", false, "write output to file instead of stdout") exportCmd.PersistentFlags().BoolVarP(&IncludeShellFile, "include-shell-script", "i", false, "also output the import shell script") rootCmd.AddCommand(exportCmd) }