Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

merge: resolve conflicts with origin/main in help.go

yushen0d9d4e6b693b
diff --cc server/cmd/multica/help.go
index 63190edf8b,2117db9a96..d6b12a6223
--- a/server/cmd/multica/help.go
+++ b/server/cmd/multica/help.go
@@@ -15,26 -15,6 +15,27 @@@ const
groupAdditional = "additional"
)
+// errSilent is returned when the error message has already been printed.
+var errSilent = fmt.Errorf("")
+
+// exactArgs returns a cobra.PositionalArgs that validates the arg count
+// and prints help on failure, so users see usage context with the error.
+func exactArgs(n int) cobra.PositionalArgs {
+ return func(cmd *cobra.Command, args []string) error {
+ if len(args) != n {
+ if n == 1 {
+ fmt.Fprintf(cmd.ErrOrStderr(), "Error: accepts 1 arg, received %d\n\n", len(args))
+ } else {
+ fmt.Fprintf(cmd.ErrOrStderr(), "Error: accepts %d args, received %d\n\n", n, len(args))
+ }
+ cmd.Help()
+ return errSilent
+ }
+ return nil
+ }
+}
+
++
// initHelp configures the root command to use gh-style help output.
func initHelp(root *cobra.Command) {
root.SetHelpTemplate(rootHelpTemplate)