exercism / cli

A Go based command line tool for exercism.org.
https://exercism.org/docs/using/solving-exercises/working-locally
MIT License
1.33k stars 360 forks source link

zsh completion issue #393

Open eikenb opened 7 years ago

eikenb commented 7 years ago

$ exercism submit <tab> This lists the filenames, but won't complete them.

The output of _complete_help is as follows (below) and shows the "_files" function is missing from the argument-rest completion context.

$ exercism submit <ctrl-x>h
tags in context :completion::complete:exercism::
    argument-rest  (_arguments _exercism) 
    all-files      (_files _exercism)
tags in context :completion::complete:exercism:argument-rest:
    argument-rest  (_message _arguments _exercism)

The problem seems related to the final '*: :' entry. It adds the arguments-rest context and prevents the later file completion. Removing this line fixes the problem for me. After removing the line the help output is (below) and the completion works.

$ exercism submit <ctrl-x>h
tags in context :completion::complete:exercism::
    messages   (_message _arguments _exercism) 
    all-files  (_files _exercism)

I tested this with a empty .zshrc to be sure it wasn't a conflict with my existing config.

eikenb commented 6 years ago

Just to clarify which line I mean... It is in the _arguments call.

_arguments -s -S \
    {-c,--config}"[path to config file]"    \
    {-d,--debug}"[turn on verbose logging]" \
    {-h,--help}"[show help]"                \
    {-v,--version}"[print the version]"     \
    '(-): :->command'                       \
    '*: :'                                  \  <-THIS ONE
    && return 0;

I just deleted that second to last line.

kytrinyx commented 6 years ago

Thanks for the details, @eikenb!