Infinidat / infi.docopt_completion

BSD 3-Clause "New" or "Revised" License
109 stars 9 forks source link

docopt-completion exits with "No completion paths found" #1

Closed schmir closed 11 years ago

schmir commented 11 years ago

looks like docopt-completion fails to find the "completion paths":

$ docopt-completion fscrawler
No completion paths found.
$ echo $SHELL
/bin/zsh
$ $SHELL --version
zsh 4.3.17 (x86_64-pc-linux-gnu)
wiggin15 commented 11 years ago

docopt-completion supports zsh with oh-my-zsh and prezto only. It looks for specific paths that these frameworks use. Are you using one of these? Can you please paste the output of echo $fpath? (this lists the folders that the completion system uses)

I will update the output to be more informative. I will also supply an option to create the completion file even if the paths are not found, so the user can place them manually.

schmir commented 11 years ago

I'm not using oh-my-zsh/prezto.

fpath looks like:

/usr/share/zsh/site-functions /usr/share/zsh/4.3.17/functions/Calendar /usr/share/zsh/4.3.17/functions/Chpwd /usr/share/zsh/4.3.17/functions/Completion /usr/share/zsh/4.3.17/functions/Completion/AIX /usr/share/zsh/4.3.17/functions/Completion/BSD /usr/share/zsh/4.3.17/functions/Completion/Base /usr/share/zsh/4.3.17/functions/Completion/Cygwin /usr/share/zsh/4.3.17/functions/Completion/Darwin /usr/share/zsh/4.3.17/functions/Completion/Debian /usr/share/zsh/4.3.17/functions/Completion/Linux /usr/share/zsh/4.3.17/functions/Completion/Mandriva /usr/share/zsh/4.3.17/functions/Completion/Redhat /usr/share/zsh/4.3.17/functions/Completion/Solaris /usr/share/zsh/4.3.17/functions/Completion/Unix /usr/share/zsh/4.3.17/functions/Completion/X /usr/share/zsh/4.3.17/functions/Completion/Zsh /usr/share/zsh/4.3.17/functions/Completion/openSUSE /usr/share/zsh/4.3.17/functions/Exceptions /usr/share/zsh/4.3.17/functions/MIME /usr/share/zsh/4.3.17/functions/Misc /usr/share/zsh/4.3.17/functions/Newuser /usr/share/zsh/4.3.17/functions/Prompts /usr/share/zsh/4.3.17/functions/TCP /usr/share/zsh/4.3.17/functions/VCS_Info /usr/share/zsh/4.3.17/functions/VCS_Info/Backends /usr/share/zsh/4.3.17/functions/Zftp /usr/share/zsh/4.3.17/functions/Zle

thanks for looking into this..

wiggin15 commented 11 years ago

@schmir can you please check the development branch, and see if the tool works for you now? I added a few fixes, it should find the path now.

schmir commented 11 years ago

that fails with an import error using docopt 0.6.1:

[dev]  ~/ % docopt-completion fscrawler                                                                    
Traceback (most recent call last):
  File "/home/ralf/local/bin/docopt-completion", line 9, in <module>
    load_entry_point('infi.docopt-completion==0.1.1-develop-5-g07dd502', 'console_scripts', 'docopt-completion')()
  File "/home/ralf/infi.docopt_completion/src/infi/docopt_completion/docopt_completion.py", line 66, in main
    docopt_completion(cmd, manual_zsh, manual_bash)
  File "/home/ralf/infi.docopt_completion/src/infi/docopt_completion/docopt_completion.py", line 55, in docopt_completion
    param_tree, option_help = parse_params(cmd)
  File "/home/ralf/infi.docopt_completion/src/infi/docopt_completion/common.py", line 84, in parse_params
    from docopt import parse_doc_options, parse_pattern, formal_usage, printable_usage
ImportError: cannot import name parse_doc_options
wiggin15 commented 11 years ago

Thanks for pointing this out. I changed the interfaces to match the latest docopt. Can you please try now?

schmir commented 11 years ago

yes, that work's now. Thanks!

One more thing I think there's no good reason to forbid the slash character in command names (just do an os.path.basename).

wiggin15 commented 11 years ago

Done. Thanks for your help. Feel free to open more issues that you find.

indi-ca commented 11 years ago

Hi. I'm getting the same message: Command does not exist or command help failed.

echo $SHELL /bin/zsh

$SHELL --version zsh 5.0.2 (x86_64-apple-darwin12.4.0)

echo $fpath /Users/indika/.oh-my-zsh/plugins/virtualenv /Users/indika/.oh-my-zsh/plugins/mvn /Users/indika/.oh-my-zsh/plugins/git /Users/indika/.oh-my-zsh/functions /Users/indika/.oh-my-zsh/completions /usr/local/share/zsh/site-functions /usr/local/Cellar/zsh/5.0.2/share/zsh/functions

I tried with both the version obtained from pip, and by cloning the development branch. Anything obvious I'm missing?

wiggin15 commented 11 years ago

Hi. This isn't exactly the same message. Looks like the problem is with the script you are passing to docopt-completion. docopt-completion tries to run the given argument (your script name) with --help. e.g. if you ru docopt-completion foo, it will try foo --help. Try to run it yourself, and then run echo $? to see if your script returns 0 when being run with --help

indi-ca commented 11 years ago

Right. I was wondering why your example does not include .py extension after foo - because it processes the command, not the source. And your source is more sophisticated that the one's I write. Noob apologies.