From 44330950457af69f323b873ade7291b7969f8671 Mon Sep 17 00:00:00 2001 From: Pasha Sviderski Date: Fri, 21 Nov 2025 22:08:32 +1000 Subject: [PATCH] chore: show links to docs and Discord for the root 'uc --help' command --- cmd/uncloud/main.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/cmd/uncloud/main.go b/cmd/uncloud/main.go index 4fb9e2db..29aa8be0 100644 --- a/cmd/uncloud/main.go +++ b/cmd/uncloud/main.go @@ -6,6 +6,7 @@ import ( "net/netip" "strings" + "github.com/charmbracelet/lipgloss" "github.com/psviderski/uncloud/cmd/uncloud/caddy" cmdcontext "github.com/psviderski/uncloud/cmd/uncloud/context" "github.com/psviderski/uncloud/cmd/uncloud/dns" @@ -87,6 +88,24 @@ func main() { cmd.PersistentFlags().StringVarP(&opts.context, "context", "c", "", "Name of the cluster context to use (default is the current context). [$UNCLOUD_CONTEXT]") + // Set custom help function to show links to docs and Discord only for the root 'uc' command. + defaultHelpFunc := cmd.HelpFunc() + cmd.SetHelpFunc(func(c *cobra.Command, args []string) { + defaultHelpFunc(c, args) + // Only show links for the root 'uc' command. + if c.Name() == "uc" { + urlStyle := lipgloss.NewStyle(). + Underline(true). + Foreground(lipgloss.Color("12")) // light blue + + fmt.Fprintln(c.OutOrStdout()) + fmt.Fprintf(c.OutOrStdout(), "Learn more about Uncloud: %s\n", + urlStyle.Render("https://uncloud.run/docs")) + fmt.Fprintf(c.OutOrStdout(), "Join our Discord community: %s\n", + urlStyle.Render("https://uncloud.run/discord")) + } + }) + cmd.AddCommand( NewDeployCommand(), NewDocsCommand(),