From 06da4ca080b95ebc6450404d9682eb7680dca5e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Fernando=20Carri=C3=B3n?= Date: Fri, 13 Oct 2023 15:51:56 +0200 Subject: [PATCH] better help --- README.md | 10 ++++++++-- main.go | 30 +++++++++++++++++++++++++++++- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f24ac32..6dbcd81 100644 --- a/README.md +++ b/README.md @@ -9,13 +9,19 @@ like `lookup`. ```bash $ ./spry -Usage of ./spry: +Usage of ./spry [Options] [Template Files]: -d string Output delimiter between template files rendered (default "---") -f value Specify a values file (JSON or YAML) -helm - Whether to nest provided values under .Values + Helm compatibility: provided values will be nested under .Values -set value Set a specific value (foo.bar=spam) + +Template Files can also be directories to recurse for templates. + +If no template files are provided it will attempt read from STDIN. +If no input is available from STDIN it will print this usage message instead. +Pass only '-' to Template Files to force waiting for input. ``` diff --git a/main.go b/main.go index aa861af..a8127f6 100644 --- a/main.go +++ b/main.go @@ -88,8 +88,36 @@ func init() { "d", "---", "Output delimiter between template files rendered", ) - flag.BoolVar(&flags.helmCompat, "helm", false, "Whether to nest provided values under .Values") + flag.BoolVar( + &flags.helmCompat, + "helm", false, + "Helm compatibility: provided values will be nested under .Values", + ) flag.Parse() + + flag.Usage = func() { + fmt.Fprintf(flag.CommandLine.Output(), "Usage of %s [Options] [Template Files]:\n", os.Args[0]) + flag.PrintDefaults() + fmt.Fprintf(flag.CommandLine.Output(), "\n") + fmt.Fprintf( + flag.CommandLine.Output(), + "Template Files can also be directories to recurse for templates.\n", + ) + fmt.Fprintf(flag.CommandLine.Output(), "\n") + fmt.Fprintf( + flag.CommandLine.Output(), + "If no template files are provided it will attempt read from STDIN.\n", + ) + fmt.Fprintf( + flag.CommandLine.Output(), + "If no input is available from STDIN it will print this usage message instead.\n", + ) + fmt.Fprintf( + flag.CommandLine.Output(), + "Pass only '-' to Template Files to force waiting for input.\n", + ) + fmt.Fprintf(flag.CommandLine.Output(), "\n") + } } func checkErr(err error) {