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

bash autocomplete not working #2017

Open
3 tasks done
Aleksei-Badyaev opened this issue Nov 28, 2024 · 6 comments
Open
3 tasks done

bash autocomplete not working #2017

Aleksei-Badyaev opened this issue Nov 28, 2024 · 6 comments
Labels
area/v2 relates to / is being considered for v2 kind/bug describes or fixes a bug status/triage maintainers still need to look into this

Comments

@Aleksei-Badyaev
Copy link

My urfave/cli version is

github.com/urfave/cli/v2 v2.27.5

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.
  • My project is using vendoring.

Describe the bug

A clear and concise description of what the bug is.

I built my application as specified in the documentation and use it as specified in https://cli.urfave.org/v2/examples/bash-completions/
However, when you press TAB on the command line with an incomplete sub-command name, nothing happens.

To reproduce

PROG=./out/bin/myprog source ./scripts/bash_autocomplete
./out/bin/myprog subcomm[press TAB]

Observed behavior

Nothing happens.

Expected behavior

bash auto-complete command in command-line to "subcommand".

Run go version and paste its output here

go version go1.23.2 linux/amd64

Run go env and paste its output here

GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/user/.cache/go-build'
GOENV='/home/user/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/user/projects/go/pkg/mod'
GOOS='linux'
GOPATH='/home/user/projects/go'
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.23.2'
GODEBUG=''
GOTELEMETRY='local'
GOTELEMETRYDIR='/home/user/.config/go/telemetry'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/dev/null'
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 -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build3090962808=/tmp/go-build -gno-record-gcc-switches'
@Aleksei-Badyaev Aleksei-Badyaev added area/v2 relates to / is being considered for v2 kind/bug describes or fixes a bug status/triage maintainers still need to look into this labels Nov 28, 2024
@dearchap
Copy link
Contributor

@Aleksei-Badyaev Can you try PROG=myprog source ./scripts/bash_autocomplete ?

@Aleksei-Badyaev
Copy link
Author

@Aleksei-Badyaev Can you try PROG=myprog source ./scripts/bash_autocomplete ?

I've already done that. I wrote above that I did everything exactly according to the documentation.

@dearchap
Copy link
Contributor

@Aleksei-Badyaev does the autocomplete work when you just press ./out/bin/myprog <TAB> without the subcommand ?

@bartekpacia
Copy link
Member

See #1905 and #1874

We plan on making shell completion easier to use in v3.

@Aleksei-Badyaev
Copy link
Author

@Aleksei-Badyaev does the autocomplete work when you just press ./out/bin/myprog <TAB> without the subcommand ?

NO - nothing happens.

@bartekpacia
Copy link
Member

Hey Aleksei,

I have 3 simple Go CLI programs that are built with urfave/cli/v3 (not v2) and they support shell completion just fine. You might want to check them out as examples:

If you're on mac, you can install them with Homebrew: e.g. brew install bartekpacia/tools/emu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/v2 relates to / is being considered for v2 kind/bug describes or fixes a bug status/triage maintainers still need to look into this
Projects
None yet
Development

No branches or pull requests

3 participants