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

keybase client should support zsh completion #519

Open
bgpugh opened this issue Apr 6, 2014 · 7 comments
Open

keybase client should support zsh completion #519

bgpugh opened this issue Apr 6, 2014 · 7 comments

Comments

@bgpugh
Copy link

bgpugh commented Apr 6, 2014

For feature parity with #147 ;-)

@emory
Copy link

emory commented Apr 7, 2014

Isn't that entirely dependent upon the shell complete grammar? I mean, I can get why a bash user is confused and all. Is it important that keybase do this for us or can't we just create one and let people use it if they want?

i'll get it started:

 #compdef keybase
 #autoload

 # keybase zsh completion

 local -a _1st_arguments
 _1st_arguments=(
     'login:keybase login'
     'logout:keybase logout'
     'decrypt:decrypt message'
     'encrypt:encrypt message'
     'help:halp'
 )

@ghost
Copy link

ghost commented Aug 11, 2014

With followingcommands from stackoverflow

autoload bashcompinit
bashcompinit
source /path/to/your/bash_completion_file

I was able to activate the bash-completion in zsh. Only thing not working is when it is trying to complete filenames or directories since zsh don't know what to make out of the _filedir helper function

@rbirnie
Copy link

rbirnie commented Feb 6, 2015

I have a sweet spot in my heart for auto completion. Here ya go: oh-my-zsh-keybase

@malgorithms
Copy link
Contributor

hey, nice to see keybase dir sign on the project. I was thinking no one was using that :-)

@rbirnie
Copy link

rbirnie commented Feb 6, 2015

I saw keybase dir sign on the bash autocomplete script repo and thought "what a great idea" so included it in mine as well. Its a pretty neat feature, I'm sure I'll find other places to use it as well.

@espoelstra
Copy link

The upstream CLI library used in Keybase appears to support ZSH or Bash for completion. It should just require edits similar to the PR above be made to add the --generate-zsh-completion flag and enable it on all the commands.

@blaggacao
Copy link

blaggacao commented May 8, 2020

Here is what I did, adapted from: https://github.com/urfave/cli/blob/master/autocomplete/zsh_autocomplete

       │ File: .oh-my-zsh/completions/_keybase
───────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────
   1   │ #compdef keybase
   2   │ 
   3   │ _cli_zsh_autocomplete() {
   4   │ 
   5   │   local -a opts
   6   │   local cur
   7   │   cur=${words[-1]}
   8   │   if [[ "$cur" == "-"* ]]; then
   9   │     opts=("${(@f)$(_CLI_ZSH_AUTOCOMPLETE_HACK=1 ${words[@]:0:#words[@]-1} ${cur} --generate-bash-completion)
       │ }")
  10   │   else
  11   │     opts=("${(@f)$(_CLI_ZSH_AUTOCOMPLETE_HACK=1 ${words[@]:0:#words[@]-1} --generate-bash-completion)}")
  12   │   fi
  13   │ 
  14   │   if [[ "${opts[1]}" != "" ]]; then
  15   │     _describe 'values' opts
  16   │   else
  17   │     _files
  18   │   fi
  19   │ 
  20   │   return
  21   │ }
  22   │ 
  23   │ compdef _cli_zsh_autocomplete keybase

I assume https://github.com/rbirnie/oh-my-zsh-keybase/blob/master/keybase/_keybase printout is nicer, though. But the above auto-updates...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants