mirror of
https://github.com/mikefarah/yq.git
synced 2024-12-19 20:19:04 +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 {
|
||||
var prettyPrintExp = `(... | (select(tag != "!!str"), select(tag == "!!str") | select(test("(?i)^(y|yes|n|no|on|off)$") | not)) ) style=""`
|
||||
if prettyPrint && expression == "" {
|
||||
return `... style=""`
|
||||
return prettyPrintExp
|
||||
} else if prettyPrint {
|
||||
return fmt.Sprintf("%v | ... style= \"\"", expression)
|
||||
return fmt.Sprintf("%v | %v", expression, prettyPrintExp)
|
||||
}
|
||||
return expression
|
||||
}
|
||||
|
@ -1,4 +1,2 @@
|
||||
---
|
||||
# hi peeps
|
||||
# cool
|
||||
a: test
|
||||
- ["oy", "yo", "ohno", "nom", "y", "Y", "n", "yes", "no", "on", "off", "true", "false", "apples"]
|
||||
- [y, n, yes, no, on, off, true, false]
|
Loading…
Reference in New Issue
Block a user