Cli: Setting Command.UsageText fails to replace default text

Created on 29 Jan 2017  路  2Comments  路  Source: urfave/cli

I am attempting to replace the UsageText for a command but it doesn't seem to work:

Program:

package main

import (
    "fmt"
    "os"

    "github.com/urfave/cli"
)

func main() {
    app := cli.NewApp()
    app.Name = "Test App"
    app.HelpName = "app"
    app.Version = "1.2.3"
    app.Commands = []cli.Command{
        {
            Name:      "start",
            Usage:     "Starts the server",
            UsageText: "I'm superman",
            Action: func(c *cli.Context) {
                fmt.Println("Start the server...")
            },
        },
    }

    app.Run(os.Args)
}

Output from go run main.go:

NAME:
   Test App - A new cli application

USAGE:
   app [global options] command [command options] [arguments...]

VERSION:
   1.2.3

COMMANDS:
     start    Starts the server
     help, h  Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --help, -h     show help
   --version, -v  print the version

Output from go run main.go start --help:

NAME:
   app start - Starts the server

USAGE:
   app start [arguments...]
kinbug

Most helpful comment

I have just tried to use v1 and the bug is still there

All 2 comments

Thanks for the report @nicklaw5! It looks like UsageText was ignored for commands and subcommands. This should be addressed by #593.

I have just tried to use v1 and the bug is still there

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lynncyrin picture lynncyrin  路  26Comments

odiferousmint picture odiferousmint  路  14Comments

Nokel81 picture Nokel81  路  14Comments

nikkolasg picture nikkolasg  路  16Comments

lynncyrin picture lynncyrin  路  22Comments