mirror of
https://github.com/mikefarah/yq.git
synced 2026-07-10 08:35:42 +00:00
detect inputFormat only when file is provided
This commit is contained in:
parent
b7561adfa6
commit
ff41e9f1ed
@ -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(true, inputFilename)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user