fix(cli): improve help name and description

This commit is contained in:
Micheal Wilkinson
2026-03-20 09:54:42 +00:00
parent e09bdd78c2
commit d638f201fe
2 changed files with 28 additions and 3 deletions

View File

@@ -5,6 +5,7 @@ import (
"fmt"
"io"
"os"
"path/filepath"
"strings"
"git.hrafn.xyz/aether/gosick/internal/homesick/core"
@@ -21,8 +22,8 @@ func Run(args []string, stdout io.Writer, stderr io.Writer) int {
parser, err := kong.New(
&cliModel{},
kong.Name("homesick"),
kong.Description("Go scaffold"),
kong.Name(programName()),
kong.Description("Your home is your castle. Don't leave your precious dotfiles behind."),
kong.Writers(stdout, stderr),
kong.Exit(func(int) {}),
kong.ConfigureHelp(kong.HelpOptions{Compact: true}),
@@ -192,6 +193,16 @@ func defaultCastle(castle string) string {
return castle
}
func programName() string {
if len(os.Args) > 0 {
if name := strings.TrimSpace(filepath.Base(os.Args[0])); name != "" {
return name
}
}
return "gosick"
}
func normalizeArgs(args []string) []string {
if len(args) == 0 {
return []string{"--help"}