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
$ ./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.
```

30
main.go
View File

@ -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) {