jazzband / Watson

:watch: A wonderful CLI to track your time!
http://tailordev.github.io/Watson/
MIT License
2.46k stars 240 forks source link

Command line completion on MacOS and Oh-my-Zsh broken #477

Open romixch opened 2 years ago

romixch commented 2 years ago

I love Watson! But since I upgraded to version 2.1 my command line completion does not work.

I installed it with brew install watson Uninstall and reinstall did not help. I extended my .zshrc with autoload -Uz compinit && compinit rm "$ZSH_COMPDUMP" did not help. Code completion for other command line tools do work.

Further information:

$ ls -lah /usr/local/share/zsh/site-functions
total 0
drwxr-xr-x  8 roman  admin   256B 24 Jun 11:32 .
drwxr-xr-x  3 roman  admin    96B  9 Okt  2019 ..
lrwxr-xr-x  1 roman  admin    39B  9 Okt  2019 _brew -> ../../../Homebrew/completions/zsh/_brew
lrwxr-xr-x  1 roman  admin    88B 15 Jan  2021 _brew_services -> ../../../Homebrew/Library/Taps/homebrew/homebrew-services/completions/zsh/_brew_services
lrwxr-xr-x  1 roman  admin    60B 23 Jun 21:39 _meson -> ../../../Cellar/meson/0.62.2/share/zsh/site-functions/_meson
lrwxr-xr-x  1 roman  admin    66B 24 Jun 08:27 _minikube -> ../../../Cellar/minikube/1.26.0/share/zsh/site-functions/_minikube
lrwxr-xr-x  1 roman  admin    60B 23 Jun 21:38 _ninja -> ../../../Cellar/ninja/1.11.0/share/zsh/site-functions/_ninja
lrwxr-xr-x  1 roman  admin    61B 24 Jun 11:32 _watson -> ../../../Cellar/watson/2.1.0/share/zsh/site-functions/_watson

$ watson --version
Watson, version 2.1.0

$ python --version
Python 2.7.18

$ python3 --version
Python 3.8.9

$ zsh --version
zsh 5.8.1 (x86_64-apple-darwin21.0)

I am stuck right now. I can't find any error message. I just got the system bell. Command line completion is pretty essential to me.

mrpsharp commented 2 years ago

I have the same issue. I think it is what PR #473 refers to.

romixch commented 2 years ago

Pretty sure this is a duplicate of the PR #473.

romixch commented 2 years ago

I reopen this bug because I can only find a pull request but no bug to it. Unfortunately there is nothing going on here since the release of version 2.1.0. The last commit was on may 16. Does anybody know why? If there was at least an easy workaround to install the old version 2.0.1.

capital-G commented 2 years ago

Switching to 2.0.1 via

 pip3 install --upgrade git+https://github.com/TailorDev/Watson.git@2.0.1

does not help, but at least it shows an error when you try to autocomplete via zsh

❯ watson
Traceback (most recent call last):
  File "/usr/local/bin/watson", line 5, in <module>
    from watson.__main__ import cli
  File "/usr/local/lib/python3.10/site-packages/watson/__main__.py", line 1, in <module>
    from watson import cli
  File "/usr/local/lib/python3.10/site-packages/watson/cli.py", line 215, in <module>
    def start(ctx, watson, confirm_new_project, confirm_new_tag, args, at_,
  File "/usr/local/lib/python3.10/site-packages/click/decorators.py", line 287, in decorator
    _param_memo(f, ArgumentClass(param_decls, **attrs))
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 2950, in __init__
    super().__init__(param_decls, required=required, **attrs)
TypeError: Parameter.__init__() got an unexpected keyword argument 'autocompletion'
Traceback (most recent call last):
  File "/usr/local/bin/watson", line 5, in <module>
    from watson.__main__ import cli
  File "/usr/local/lib/python3.10/site-packages/watson/__main__.py", line 1, in <module>
    from watson import cli
  File "/usr/local/lib/python3.10/site-packages/watson/cli.py", line 215, in <module>
    def start(ctx, watson, confirm_new_project, confirm_new_tag, args, at_,
  File "/usr/local/lib/python3.10/site-packages/click/decorators.py", line 287, in decorator
    _param_memo(f, ArgumentClass(param_decls, **attrs))
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 2950, in __init__
    super().__init__(param_decls, required=required, **attrs)
TypeError: Parameter.__init__() got an unexpected keyword argument 'autocompletion'
Traceback (most recent call last):
  File "/usr/local/bin/watson", line 5, in <module>
    from watson.__main__ import cli
  File "/usr/local/lib/python3.10/site-packages/watson/__main__.py", line 1, in <module>
    from watson import cli
  File "/usr/local/lib/python3.10/site-packages/watson/cli.py", line 215, in <module>
    def start(ctx, watson, confirm_new_project, confirm_new_tag, args, at_,
  File "/usr/local/lib/python3.10/site-packages/click/decorators.py", line 287, in decorator
    _param_memo(f, ArgumentClass(param_decls, **attrs))
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 2950, in __init__
    super().__init__(param_decls, required=required, **attrs)
TypeError: Parameter.__init__() got an unexpected keyword argument 'autocompletion'
Traceback (most recent call last):
  File "/usr/local/bin/watson", line 5, in <module>
    from watson.__main__ import cli
  File "/usr/local/lib/python3.10/site-packages/watson/__main__.py", line 1, in <module>
    from watson import cli
  File "/usr/local/lib/python3.10/site-packages/watson/cli.py", line 215, in <module>
    def start(ctx, watson, confirm_new_project, confirm_new_tag, args, at_,
  File "/usr/local/lib/python3.10/site-packages/click/decorators.py", line 287, in decorator
    _param_memo(f, ArgumentClass(param_decls, **attrs))
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 2950, in __init__
    super().__init__(param_decls, required=required, **attrs)
TypeError: Parameter.__init__() got an unexpected keyword argument 'autocompletion'
Traceback (most recent call last):
  File "/usr/local/bin/watson", line 5, in <module>
    from watson.__main__ import cli
  File "/usr/local/lib/python3.10/site-packages/watson/__main__.py", line 1, in <module>
    from watson import cli
  File "/usr/local/lib/python3.10/site-packages/watson/cli.py", line 215, in <module>
    def start(ctx, watson, confirm_new_project, confirm_new_tag, args, at_,
  File "/usr/local/lib/python3.10/site-packages/click/decorators.py", line 287, in decorator
    _param_memo(f, ArgumentClass(param_decls, **attrs))
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 2950, in __init__
    super().__init__(param_decls, required=required, **attrs)
TypeError: Parameter.__init__() got an unexpected keyword argument 'autocompletion'

Also switching to the PR branch via

pip3 install --upgrade git+https://github.com/voidus/Watson.git@fix-completions

did not fix this issue for me as well ;/

Kai-Hei commented 2 years ago

I had the same issue the other day (macOS / brew install watson)

I patched /usr/local/Cellar/watson/2.1.0/libexec/lib/python3.10/site-packages/watson/autocompletion.py $ cd /usr/local/Cellar/watson/2.1.0/libexec/lib/python3.10/site-packages $ patch watson/autocompletion.py ~/Downloads/quickfix_autocomplete_on_macOS.patch.txt

Then I replaced /usr/local/Cellar/watson/2.1.0/share/zsh/site-functions/_watson calling $ _WATSON_COMPLETE=zsh_source watson > /usr/local/Cellar/watson/2.1.0/share/zsh/site-functions/_watson (it's zsh_source, not source_zsh)

Check using echo $fpath that /usr/local/share/zsh/site-functions is in the search path for function definitions.

Seems to work for me, now.

quickfix_autocomplete_on_macOS.patch.txt