mirror of
https://github.com/mikefarah/yq.git
synced 2025-01-27 08:55:37 +00:00
Fixed auto parsing toml
This commit is contained in:
parent
9f50a49cc4
commit
f01804db66
@ -66,7 +66,7 @@ yq -P sample.json
|
||||
}
|
||||
|
||||
rootCmd.PersistentFlags().StringVarP(&outputFormat, "output-format", "o", "auto", "[auto|a|yaml|y|json|j|props|p|xml|x] output format type.")
|
||||
rootCmd.PersistentFlags().StringVarP(&inputFormat, "input-format", "p", "auto", "[auto|a|yaml|y|props|p|xml|x|toml|t] parse format for input. Note that json is a subset of yaml.")
|
||||
rootCmd.PersistentFlags().StringVarP(&inputFormat, "input-format", "p", "auto", "[auto|a|yaml|y|props|p|xml|x|toml] parse format for input. Note that json is a subset of yaml.")
|
||||
|
||||
rootCmd.PersistentFlags().StringVar(&yqlib.ConfiguredXMLPreferences.AttributePrefix, "xml-attribute-prefix", yqlib.ConfiguredXMLPreferences.AttributePrefix, "prefix for xml attributes")
|
||||
rootCmd.PersistentFlags().StringVar(&yqlib.ConfiguredXMLPreferences.ContentName, "xml-content-name", yqlib.ConfiguredXMLPreferences.ContentName, "name for xml content (if no attribute name is present).")
|
||||
|
@ -61,7 +61,12 @@ func initCommand(cmd *cobra.Command, args []string) (string, []string, error) {
|
||||
|
||||
inputFormat = yqlib.FormatFromFilename(inputFilename)
|
||||
if outputFormat == "" || outputFormat == "auto" || outputFormat == "a" {
|
||||
outputFormat = yqlib.FormatFromFilename(inputFilename)
|
||||
if inputFormat == "toml" {
|
||||
// toml not yet supported for output
|
||||
outputFormat = "yaml"
|
||||
} else {
|
||||
outputFormat = yqlib.FormatFromFilename(inputFilename)
|
||||
}
|
||||
}
|
||||
} else if outputFormat == "" || outputFormat == "auto" || outputFormat == "a" {
|
||||
// backwards compatibility -
|
||||
|
Loading…
Reference in New Issue
Block a user