From 091c845c79b0aaf031e2fbbeaa91edb45d8d0272 Mon Sep 17 00:00:00 2001 From: Benjamin Chausse Date: Wed, 26 Mar 2025 17:21:12 -0400 Subject: De-bloat + goreleaser packages manpage --- internal/app/app.go | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) (limited to 'internal/app/app.go') diff --git a/internal/app/app.go b/internal/app/app.go index da19002..d0b168d 100644 --- a/internal/app/app.go +++ b/internal/app/app.go @@ -3,23 +3,16 @@ package app import ( "context" _ "embed" - "fmt" - "io" "log/slog" "github.com/ChausseBenjamin/termpicker/internal/logging" "github.com/ChausseBenjamin/termpicker/internal/switcher" tea "github.com/charmbracelet/bubbletea" - "github.com/charmbracelet/glamour" - docs "github.com/urfave/cli-docs/v3" "github.com/urfave/cli/v3" ) -//go:embed keybindings.md -var KeybindingDocs string - -// Set by the build system -var version = "compiled" +//go:embed description.txt +var Desc string func AppAction(ctx context.Context, cmd *cli.Command) error { logfile := logging.Setup(cmd.String("logfile")) @@ -40,28 +33,18 @@ func AppAction(ctx context.Context, cmd *cli.Command) error { return nil } -func Command() *cli.Command { +func Command(version string) *cli.Command { cmd := &cli.Command{ Name: "termpicker", Usage: "A terminal-based color picker", Action: AppAction, + ArgsUsage: "", + Description: Desc, Authors: []any{"Benjamin Chausse "}, Version: version, Flags: AppFlags, EnableShellCompletion: true, } - cli.HelpPrinter = func(w io.Writer, _ string, _ any) { - docs.MarkdownDocTemplate = fmt.Sprintf("%s\n‎\n\n%s", - docs.MarkdownDocTemplate, - KeybindingDocs, - ) - - helpRaw, _ := docs.ToMarkdown(cmd) - helpCute, _ := glamour.Render(helpRaw, "auto") - - w.Write([]byte(helpCute)) - } - return cmd } -- cgit v1.2.3