profclems / glab

The GitLab CLI tool. Archived: now officially adopted by GitLab as the official CLI tool and maintained at https://gitlab.com/gitlab-org/cli. See https://github.com/profclems/glab/issues/983
https://glab.readthedocs.io/
MIT License
2.08k stars 163 forks source link

Provide zsh completion #986

Closed jclsn closed 2 years ago

jclsn commented 2 years ago

Describe the feature or problem you'd like to solve The bash completion file can't be loaded in zsh.

Propose a Solution Also generate a zsh completion file

zemzale commented 2 years ago

@jclsn For zsh you just need to use glab completion --shell zsh

jclsn commented 2 years ago

That doesn't work for me

I put the completion script in a file in $FPATH and when I press tab multiple times I get the names of the files contained in the folder.

$ glab glab.zsh glab.zsh glab.zsh 

whereas with bash I get

$ glab 
alias         (Create, list and delete aliases)              ci            (Work with GitLab CI pipelines and jobs)       issue         (Work with GitLab issues)                      repo          (Work with GitLab repositories and projects)   variable      (Manage GitLab Project and Group Variables)
api           (Make an authenticated request to GitLab API)  completion    (Generate shell completion scripts)            label         (Manage labels on remote)                      snippet       (Create, view and manage snippets)             version       (show glab version information)
auth          (Manage glab's authentication state)           config        (Set and get glab settings)                    mr            (Create, view and manage merge requests)       ssh-key       (Manage SSH keys)                              
check-update  (Check for latest glab releases)               help          (Help about any command)                       release       (Manage GitLab releases)                       user          (Interact with user) 
zemzale commented 2 years ago

That is an issue with your shell setup then, not the completion script. Works just fine for me. Try running

  autoload -U compinit && compinit

and then see if it works

jclsn commented 2 years ago

No, that doesn't make a difference unfortunately. I use oh-my-zsh. Don't think that it would conflict with the script. I just tried moving the .oh-my-zsh directory and .zshrc for a clean configuration, but it still doesn't work.

How do you load the file? On Apr. 8 2022, at 1:25 pm, zemzale @.***> wrote:

That is an issue with your shell setup then, not the completion script. Works just fine for me. Try running

autoload -U compinit && compinit and then see if it works

— Reply to this email directly, view it on GitHub (https://github.com/profclems/glab/issues/986#issuecomment-1092761323), or unsubscribe (https://github.com/notifications/unsubscribe-auth/AEW47NYNOPXXVLK3HDW6UE3VEAJSNANCNFSM5SVCU2ZA). You are receiving this because you were mentioned.

justin-f-perez commented 2 years ago

No, that doesn't make a difference unfortunately. I use oh-my-zsh. Don't think that it would conflict with the script. I just tried moving the .oh-my-zsh directory and .zshrc for a clean configuration, but it still doesn't work. How do you load the file?

man zshcompsys

personally, I let homebrew take care of it. check your zcompdump file (see the man page)