Open brucechou1983 opened 7 years ago
I finally resolved this issue by replacing the : in the bash script with :.
I don't follow -- you replaced a colon with a different colon? It would be great to have zsh support, but I haven't looked into supporting it yet. (I would also like a single completion script to work for all Fire CLIs, instead of having to generate one per CLI, but that's a bigger task than adding zsh support.)
He changed the semi column with a semi column followed by a space. It seems to work but I have some weird autocompletion problem after the first argument, I don't know if this is the normal behavior though. (I cannot autocomplete other arguments or path after the first argument is selected)
Hey guys,
is ZSH auto completion support planned?
Thanks for a followup.
Thank you @loynoir for attempting to fix the issue, but it seems to me that your PR was closed, thus the problem of completion remains the same.
@SedMek
https://github.com/google/python-fire/pull/320/commits/2faa993496bed4b7eb7298c3e01c1c377f3fd5f6
The issue that triggered the unrecognized modifier
error in ZSH should be fixed at head now. You can try and force re-installing the python-fire
package.
pip install --upgrade --force-reinstall python-fire
I confirm the zsh completion works with zsh on latest commit d44d33d4ac9389854b046ca0270c112693b309e6 . To test it, this is what I did:
git clone git@github.com:google/python-fire.git
cd python-fire
python setup.py install
Here's a simple example
#!/usr/bin/env python
import fire
class Calculator:
def add(self, a, b):
return a + b
def subtract(self, a, b):
return a - b
def multiply(self, a, b):
return a * b
def divide(self, a, b):
return a / b
if __name__ == '__main__':
fire.Fire(Calculator)
Named it calculator
and added it to a folder which is in my PATH
, then generated completions like this:
calculator -- --completion > calculator-completion
source calculator-completion
I confirm completions work fine:
I'm using zsh 5.0.8 on OSX 10.11.6.
When I tried to run the generated completion bash for the basic example in README, I got the following error.
_complete-calculatorpy:4: unrecognized modifier
C'`I finally resolved this issue by replacing the
:
in the bash script with:
.An extra option for completion command will be helpful for zsh user.