urfave/cli

[v3] Long flag usage text uses short flag syntax

zx8 opened this issue · 2 comments

zx8 commented

This is a very minor annoyance, but worth fixing I think. Short flag syntax is -e and long flag syntax is --example.

The help text for missing flags should use the long flag syntax, as this is pretty standard across all CLI tools that support short flags as well as long flags.


Info:

  • Using v3.0.0-alpha7

Code

package main

import (
  "context"
  "log"
  "os"

  "github.com/urfave/cli/v3"
)

func main() {
  cmd := &cli.Command{
    Name: "example",
  }

  if err := cmd.Run(context.Background(), os.Args); err != nil {
    log.Fatal(err)
  }
}

Expected

$ go run . --bar
flag provided but not defined: --bar

Actual

$ go run . --bar
flag provided but not defined: -bar

@zx8 Yes this is a very old issue/request. This is the error that the golang flag library returns. Until we move away from that library its unlikely we will fix it.

zx8 commented

Ahh right, ok, so nothing to do with v3 – closing!