better help

This commit is contained in:
Diego Fernando Carrión 2023-10-13 15:51:56 +02:00
parent 9d1f97258a
commit 06da4ca080
Signed by: CRThaze
GPG Key ID: 0F647F8A6A3AF588
2 changed files with 37 additions and 3 deletions

View File

@ -9,13 +9,19 @@ like `lookup`.
```bash ```bash
$ ./spry $ ./spry
Usage of ./spry: Usage of ./spry [Options] [Template Files]:
-d string -d string
Output delimiter between template files rendered (default "---") Output delimiter between template files rendered (default "---")
-f value -f value
Specify a values file (JSON or YAML) Specify a values file (JSON or YAML)
-helm -helm
Whether to nest provided values under .Values Helm compatibility: provided values will be nested under .Values
-set value -set value
Set a specific value (foo.bar=spam) 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.
``` ```

30
main.go
View File

@ -88,8 +88,36 @@ func init() {
"d", "---", "d", "---",
"Output delimiter between template files rendered", "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.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) { func checkErr(err error) {