mirror of
https://github.com/mikefarah/yq.git
synced 2024-11-12 13:48:06 +00:00
Use single/double instead of singleQuoted/doubleQuoted
This commit is contained in:
parent
06d8715cbe
commit
64135a16e1
@ -54,7 +54,7 @@ func TestNewWithTaggedStyleCmd(t *testing.T) {
|
|||||||
|
|
||||||
func TestNewWithDoubleQuotedStyleCmd(t *testing.T) {
|
func TestNewWithDoubleQuotedStyleCmd(t *testing.T) {
|
||||||
cmd := getRootCommand()
|
cmd := getRootCommand()
|
||||||
result := test.RunCmd(cmd, "new b.c cat --style=doubleQuoted")
|
result := test.RunCmd(cmd, "new b.c cat --style=double")
|
||||||
if result.Error != nil {
|
if result.Error != nil {
|
||||||
t.Error(result.Error)
|
t.Error(result.Error)
|
||||||
}
|
}
|
||||||
@ -66,7 +66,7 @@ func TestNewWithDoubleQuotedStyleCmd(t *testing.T) {
|
|||||||
|
|
||||||
func TestNewWithSingleQuotedStyleCmd(t *testing.T) {
|
func TestNewWithSingleQuotedStyleCmd(t *testing.T) {
|
||||||
cmd := getRootCommand()
|
cmd := getRootCommand()
|
||||||
result := test.RunCmd(cmd, "new b.c cat --style=singleQuoted")
|
result := test.RunCmd(cmd, "new b.c cat --style=single")
|
||||||
if result.Error != nil {
|
if result.Error != nil {
|
||||||
t.Error(result.Error)
|
t.Error(result.Error)
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ func TestWriteWithDoubleQuotedStyleCmd(t *testing.T) {
|
|||||||
defer test.RemoveTempYamlFile(filename)
|
defer test.RemoveTempYamlFile(filename)
|
||||||
|
|
||||||
cmd := getRootCommand()
|
cmd := getRootCommand()
|
||||||
result := test.RunCmd(cmd, fmt.Sprintf("write %s b.c cat --style=doubleQuoted", filename))
|
result := test.RunCmd(cmd, fmt.Sprintf("write %s b.c cat --style=double", filename))
|
||||||
if result.Error != nil {
|
if result.Error != nil {
|
||||||
t.Error(result.Error)
|
t.Error(result.Error)
|
||||||
}
|
}
|
||||||
@ -71,7 +71,7 @@ func TestWriteWithSingleQuotedStyleCmd(t *testing.T) {
|
|||||||
defer test.RemoveTempYamlFile(filename)
|
defer test.RemoveTempYamlFile(filename)
|
||||||
|
|
||||||
cmd := getRootCommand()
|
cmd := getRootCommand()
|
||||||
result := test.RunCmd(cmd, fmt.Sprintf("write %s b.c cat --style=singleQuoted", filename))
|
result := test.RunCmd(cmd, fmt.Sprintf("write %s b.c cat --style=single", filename))
|
||||||
if result.Error != nil {
|
if result.Error != nil {
|
||||||
t.Error(result.Error)
|
t.Error(result.Error)
|
||||||
}
|
}
|
||||||
|
@ -19,14 +19,16 @@ func (v *valueParser) Parse(argument string, customTag string, customStyle strin
|
|||||||
var style yaml.Style
|
var style yaml.Style
|
||||||
if customStyle == "tagged" {
|
if customStyle == "tagged" {
|
||||||
style = yaml.TaggedStyle
|
style = yaml.TaggedStyle
|
||||||
} else if customStyle == "doubleQuoted" {
|
} else if customStyle == "double" {
|
||||||
style = yaml.DoubleQuotedStyle
|
style = yaml.DoubleQuotedStyle
|
||||||
} else if customStyle == "singleQuoted" {
|
} else if customStyle == "single" {
|
||||||
style = yaml.SingleQuotedStyle
|
style = yaml.SingleQuotedStyle
|
||||||
} else if customStyle == "literal" {
|
} else if customStyle == "literal" {
|
||||||
style = yaml.LiteralStyle
|
style = yaml.LiteralStyle
|
||||||
} else if customStyle == "folded" {
|
} else if customStyle == "folded" {
|
||||||
style = yaml.FoldedStyle
|
style = yaml.FoldedStyle
|
||||||
|
} else if customStyle != "" {
|
||||||
|
log.Error("Unknown style %v, ignoring", customStyle)
|
||||||
}
|
}
|
||||||
|
|
||||||
if argument == "[]" {
|
if argument == "[]" {
|
||||||
|
@ -13,8 +13,8 @@ var parseStyleTests = []struct {
|
|||||||
}{
|
}{
|
||||||
{"", 0},
|
{"", 0},
|
||||||
{"tagged", yaml.TaggedStyle},
|
{"tagged", yaml.TaggedStyle},
|
||||||
{"doubleQuoted", yaml.DoubleQuotedStyle},
|
{"double", yaml.DoubleQuotedStyle},
|
||||||
{"singleQuoted", yaml.SingleQuotedStyle},
|
{"single", yaml.SingleQuotedStyle},
|
||||||
{"folded", yaml.FoldedStyle},
|
{"folded", yaml.FoldedStyle},
|
||||||
{"literal", yaml.LiteralStyle},
|
{"literal", yaml.LiteralStyle},
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user