From 09e5c5b5c5011b4fb08ba86d46a4df09d21604ae Mon Sep 17 00:00:00 2001 From: Mike Farah Date: Sun, 15 Aug 2021 22:07:05 +1000 Subject: [PATCH] wip - pretty print 1.1 compat mode --- cmd/evalute_sequence_command.go | 5 +++-- examples/data1.yaml | 6 ++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/cmd/evalute_sequence_command.go b/cmd/evalute_sequence_command.go index f07bf542..c11a073f 100644 --- a/cmd/evalute_sequence_command.go +++ b/cmd/evalute_sequence_command.go @@ -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 } diff --git a/examples/data1.yaml b/examples/data1.yaml index 0d0503c0..5f669300 100644 --- a/examples/data1.yaml +++ b/examples/data1.yaml @@ -1,4 +1,2 @@ ---- -# hi peeps -# cool -a: test \ No newline at end of file +- ["oy", "yo", "ohno", "nom", "y", "Y", "n", "yes", "no", "on", "off", "true", "false", "apples"] +- [y, n, yes, no, on, off, true, false] \ No newline at end of file