wip - pretty print 1.1 compat mode

This commit is contained in:
Mike Farah 2021-08-15 22:07:05 +10:00
parent 4ba96d902b
commit 43f47c4ed9
2 changed files with 5 additions and 6 deletions

View File

@ -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
}

View File

@ -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]