Skip to content

Commit

Permalink
detect inputFormat only when file is provided
Browse files Browse the repository at this point in the history
  • Loading branch information
ryenus committed Mar 3, 2023
1 parent aa9a426 commit 02398ed
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion cmd/evaluate_all_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,12 @@ func evaluateAll(cmd *cobra.Command, args []string) (cmdError error) {
return err
}

decoder, err := configureDecoder(true, args[0])
inputFilename := ""
if len(args) > 0 {
inputFilename = args[0]
}

decoder, err := configureDecoder(false, inputFilename)
if err != nil {
return err
}
Expand Down
7 changes: 6 additions & 1 deletion cmd/evalute_sequence_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,12 @@ func evaluateSequence(cmd *cobra.Command, args []string) (cmdError error) {

printer := yqlib.NewPrinter(encoder, printerWriter)

decoder, err := configureDecoder(false, args[0])
inputFilename := ""
if len(args) > 0 {
inputFilename = args[0]
}

decoder, err := configureDecoder(false, inputFilename)
if err != nil {
return err
}
Expand Down

0 comments on commit 02398ed

Please sign in to comment.