mirror of
https://github.com/mikefarah/yq.git
synced 2025-02-05 15:37:02 +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(&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.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).")
|
rootCmd.PersistentFlags().StringVar(&yqlib.ConfiguredXMLPreferences.ContentName, "xml-content-name", yqlib.ConfiguredXMLPreferences.ContentName, "name for xml content (if no attribute name is present).")
|
||||||
|
@ -61,8 +61,13 @@ func initCommand(cmd *cobra.Command, args []string) (string, []string, error) {
|
|||||||
|
|
||||||
inputFormat = yqlib.FormatFromFilename(inputFilename)
|
inputFormat = yqlib.FormatFromFilename(inputFilename)
|
||||||
if outputFormat == "" || outputFormat == "auto" || outputFormat == "a" {
|
if outputFormat == "" || outputFormat == "auto" || outputFormat == "a" {
|
||||||
|
if inputFormat == "toml" {
|
||||||
|
// toml not yet supported for output
|
||||||
|
outputFormat = "yaml"
|
||||||
|
} else {
|
||||||
outputFormat = yqlib.FormatFromFilename(inputFilename)
|
outputFormat = yqlib.FormatFromFilename(inputFilename)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else if outputFormat == "" || outputFormat == "auto" || outputFormat == "a" {
|
} else if outputFormat == "" || outputFormat == "auto" || outputFormat == "a" {
|
||||||
// backwards compatibility -
|
// backwards compatibility -
|
||||||
// before this was introduced, `yq -pcsv things.csv`
|
// before this was introduced, `yq -pcsv things.csv`
|
||||||
|
Loading…
Reference in New Issue
Block a user