Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shell completion is suggesting aliases #1875

Closed
3 tasks done
bartekpacia opened this issue Mar 11, 2024 · 2 comments · Fixed by #1882
Closed
3 tasks done

Shell completion is suggesting aliases #1875

bartekpacia opened this issue Mar 11, 2024 · 2 comments · Fixed by #1882
Assignees
Labels
area/v3 relates to / is being considered for v3 kind/feature describes a code enhancement / feature request kind/question someone asking a question

Comments

@bartekpacia
Copy link
Contributor

My urfave/cli version is

v2.27.1

Checklist

  • Are you running the latest v2 release? The list of releases is here.
  • Did you check the manual for your release? The v2 manual is here
  • Did you perform a search about this problem? Here's the GitHub guide about searching.

Dependency Management

My project is using Go modules.

Describe the bug

My program called emu is built with this great module. Let's say emu has the following commands:

  • kill
  • run
  • list

The list command also has an alias ls.

The problem is that both list and ls are shown in shell completion ("TAB completion"), which doesn't make much sense and is annoying:

emu.mov

To reproduce wrong behavior

  1. Create an app that has at least 1 command with 2 or more aliases
  2. Try to use shell completion for that app
  3. Notice bug

Expected behavior

Aliases are not shown in shell completion. This is how huge, popular CLI projects like gh or docker do it:

$ docker image list --help

Usage:  docker image ls [OPTIONS] [REPOSITORY[:TAG]]

List images

Aliases:
  docker image ls, docker image list, docker images

... <omitted>
Screen.Recording.2024-03-11.at.01.53.36.mov

(in Docker's case, ls is the main command and list is an alias - so my point is still valid).

Want to fix this yourself?

Sure!

Run go version and paste its output here

go version go1.22.1 darwin/arm64

Run go env and paste its output here

GO111MODULE=''
GOARCH='arm64'
GOBIN=''
GOCACHE='/Users/bartek/Library/Caches/go-build'
GOENV='/Users/bartek/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/bartek/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/bartek/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/opt/homebrew/Cellar/go/1.22.1/libexec'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/opt/homebrew/Cellar/go/1.22.1/libexec/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.22.1'
GCCGO='gccgo'
AR='ar'
CC='cc'
CXX='c++'
CGO_ENABLED='1'
GOMOD='/Users/bartek/projects/emu/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/r6/5z0bypqn4cb8p369zlrfhw3c0000gn/T/go-build1695057898=/tmp/go-build -gno-record-gcc-switches -fno-common'
@bartekpacia bartekpacia added area/v2 relates to / is being considered for v2 kind/question someone asking a question status/triage maintainers still need to look into this labels Mar 11, 2024
@dearchap
Copy link
Contributor

dearchap commented Apr 1, 2024

This is not really a bug as much as it is a desired behaviour.

@bartekpacia
Copy link
Contributor Author

Can we mark it as v3 instead of v2 and not as bug but as "change/feature" requst?

@dearchap dearchap added kind/feature describes a code enhancement / feature request area/v3 relates to / is being considered for v3 and removed area/v2 relates to / is being considered for v2 labels Apr 16, 2024
@meatballhat meatballhat changed the title BUG: shell completion is suggesting aliases Shell completion is suggesting aliases Apr 27, 2024
@meatballhat meatballhat removed the status/triage maintainers still need to look into this label Apr 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/v3 relates to / is being considered for v3 kind/feature describes a code enhancement / feature request kind/question someone asking a question
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants