mirror of
https://github.com/mikefarah/yq.git
synced 2025-01-13 11:55:38 +00:00
wip - pretty print 1.1 compat mode
This commit is contained in:
parent
4ba96d902b
commit
43f47c4ed9
@ -44,10 +44,11 @@ expression and prints the result in sequence.`,
|
|||||||
}
|
}
|
||||||
|
|
||||||
func processExpression(expression string) string {
|
func processExpression(expression string) string {
|
||||||
|
var prettyPrintExp = `(... | (select(tag != "!!str"), select(tag == "!!str") | select(test("(?i)^(y|yes|n|no|on|off)$") | not)) ) style=""`
|
||||||
if prettyPrint && expression == "" {
|
if prettyPrint && expression == "" {
|
||||||
return `... style=""`
|
return prettyPrintExp
|
||||||
} else if prettyPrint {
|
} else if prettyPrint {
|
||||||
return fmt.Sprintf("%v | ... style= \"\"", expression)
|
return fmt.Sprintf("%v | %v", expression, prettyPrintExp)
|
||||||
}
|
}
|
||||||
return expression
|
return expression
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,2 @@
|
|||||||
---
|
- ["oy", "yo", "ohno", "nom", "y", "Y", "n", "yes", "no", "on", "off", "true", "false", "apples"]
|
||||||
# hi peeps
|
- [y, n, yes, no, on, off, true, false]
|
||||||
# cool
|
|
||||||
a: test
|
|
Loading…
Reference in New Issue
Block a user