mirror of
https://github.com/mikefarah/yq.git
synced 2024-12-19 20:19:04 +00:00
Use file extension to auto detect output format!
This commit is contained in:
parent
c1a236d720
commit
5a62b07d72
@ -70,8 +70,7 @@ func initCommand(cmd *cobra.Command, args []string) (string, []string, error) {
|
|||||||
//
|
//
|
||||||
outputFormat = yqlib.FormatFromFilename(inputFilename)
|
outputFormat = yqlib.FormatFromFilename(inputFilename)
|
||||||
if inputFilename != "-" {
|
if inputFilename != "-" {
|
||||||
yqlib.GetLogger().Warning("yq default output is now 'auto' (based on the filename extension)")
|
yqlib.GetLogger().Warning("yq default output is now 'auto' (based on the filename extension). Normally yq would output '%v', but for backwards compatibility 'yaml' has been set. Please use -oy to specify yaml, or drop the -p flag.", outputFormat)
|
||||||
yqlib.GetLogger().Warning("For backwards compatibility 'yaml' has been set as the output format. Please use -oy to specify yaml, or drop the -p flag.", outputFormat)
|
|
||||||
}
|
}
|
||||||
outputFormat = "yaml"
|
outputFormat = "yaml"
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ func InputFormatFromString(format string) (InputFormat, error) {
|
|||||||
case "tsv", "t":
|
case "tsv", "t":
|
||||||
return TSVObjectInputFormat, nil
|
return TSVObjectInputFormat, nil
|
||||||
default:
|
default:
|
||||||
return 0, fmt.Errorf("unknown format '%v' please use [yaml|xml|props]", format)
|
return 0, fmt.Errorf("unknown format '%v' please use [yaml|json|props|csv|tsv|xml]", format)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user