1
0
Fork 0
mirror of https://github.com/spf13/cobra synced 2025-04-01 20:39:12 +00:00

fix: make the test suite happy again

I've had to disable the usage template i18n.
This commit is contained in:
Goutte 2025-02-02 12:24:40 +01:00
parent de0723fc08
commit 411323dcca
6 changed files with 18 additions and 11 deletions

View file

@ -446,11 +446,14 @@ func (c *Command) UsageFunc() (f func(*Command) error) {
return func(c *Command) error {
c.mergePersistentFlags()
fn := c.getUsageTemplateFunc()
data := CommandUsageTemplateData{
Command: c,
I18n: getCommandGlossary(),
}
err := fn(c.OutOrStderr(), data)
// FIXME: this breaks the template func signature ; we need another approach ?
//data := CommandUsageTemplateData{
// Command: c,
// I18n: getCommandGlossary(),
//}
//err := fn(c.OutOrStderr(), data)
//////////////////////////////////////////////////////////////////////////////
err := fn(c.OutOrStderr(), c)
if err != nil {
c.PrintErrln(err)
}
@ -1270,7 +1273,7 @@ func (c *Command) InitDefaultHelpCmd() {
c.helpCommand = &Command{
Use: fmt.Sprintf("help [%s]", gotext.Get("command")),
Short: gotext.Get("CommandHelpShort"),
Long: fmt.Sprintf(gotext.Get("CommandHelpLong"), c.DisplayName()+fmt.Sprintf(" help [%s]", gotext.Get("command"))),
Long: fmt.Sprintf(gotext.Get("CommandHelpLong"), c.DisplayName()+fmt.Sprintf(" help [%s]", gotext.Get("PathToCommand"))),
ValidArgsFunction: func(c *Command, args []string, toComplete string) ([]string, ShellCompDirective) {
var completions []string
cmd, _, e := c.Root().Find(args)

View file

@ -160,4 +160,8 @@ msgstr ""
#: command.go:1247
#: command.go:1249
msgid "command"
msgstr ""
msgstr ""
msgid "PathToCommand"
msgstr ""

Binary file not shown.

View file

@ -168,5 +168,5 @@ msgstr "version for"
msgid "command"
msgstr "command"
#~ msgid "PathToCommand"
#~ msgstr "path to command"
msgid "PathToCommand"
msgstr "path to command"

Binary file not shown.

View file

@ -168,5 +168,5 @@ msgstr "version pour"
msgid "command"
msgstr "commande"
#~ msgid "PathToCommand"
#~ msgstr "command"
msgid "PathToCommand"
msgstr "chemin vers la commande"