Skip to content

Commit

Permalink
change default
Browse files Browse the repository at this point in the history
  • Loading branch information
CyrusJavan committed Jan 8, 2021
1 parent a805fc8 commit 3842970
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions cmd/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/spf13/cobra"
)

var WriteToStdOut bool
var WriteToFile bool
var IncludeShellFile bool

var exportCmd = &cobra.Command{
Expand All @@ -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()
Expand Down Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 3842970

Please sign in to comment.