From 769b05fb54a257458fce069e12ef735bf3b7fc98 Mon Sep 17 00:00:00 2001 From: Matt Olenik Date: Wed, 25 Oct 2017 01:41:14 -0700 Subject: [PATCH] Cleanup options and add --quiet --- main.go | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/main.go b/main.go index 4c5b908..d87588f 100644 --- a/main.go +++ b/main.go @@ -30,19 +30,20 @@ func main() { HCL Query/Edit Tool Usage: - hclq get [--raw] - hclq get [--raw] - hclq set [--in-place] - hclq set + hclq get [options] + hclq get [options] [-] + hclq set [options] + hclq set [options] [-] hclq --help hclq --version Options: - --in-place Modify file in-place instead of writing to stdout - --raw Output in raw mode (Go printf %+v) instead of JSON - --help Show this screen - --version Show version + -i --in-place Modify file in-place instead of writing to stdout + -r --raw Output in raw mode (Go printf %+v) instead of JSON + -q --quiet Ignore failures, output matches or nothing at all + --help Show this screen + --version Show version ` arguments, _ := docopt.Parse(usage, nil, true, version, false) queryNodes := query.Parse(arguments[""].(string)) @@ -55,7 +56,7 @@ Options: } else if arguments["set"].(bool) { err = set(arguments, queryNodes) } - if err != nil { + if err != nil && !arguments["--quiet"].(bool) { getErrorOutput(err, raw) os.Exit(1) }