That failing code isn't valid fish script - it's for bash's completion
framework, which is wholly incompatible. So the "source" mode here doesn't
work for fish.
What exactly is the issue with the "source-fish" mode? Can you post the
output of `env _MOLECULE_COMPLETE=source-fish molecule`?
Also, `eval` here adds a bit of overhead. If you don't need the command to
have access to stdin, you can just pipe to `source` - `env
_MOLECULE_COMPLETE=source-fish molecule | source`.
On Fri, Jul 21, 2017 at 10:41 AM Florian Dhaussy <florian.dhau...@elosi.com>
wrote:
> Hi fish community !
>
> I'm actually trying to get completion on molecule
> <https://github.com/metacloud/molecule> (a development helper for
> Ansible). This program is in python, and include the click-completion
> framework <https://github.com/click-contrib/click-completion> for
> auto-completion.
>
> Following the click documentation (as also the one from fish), I created a
> ~/.config/fish/completions/molecule.fish:
>
> # molecule.fish - molecule completions for fish shell
>
> eval (env _MOLECULE_COMPLETE=source molecule)
>
> I've just modified source-fish by only source, because it seems not
> recognized by fish.
>
> When I'm trying to auto-complete the command with tab, here is the result:
>
> #> molecule - (line 1): Illegal command name “_molecule_completion()”
>
> ven. 21 juil. 2017 09:57:46 CEST
> begin; _molecule_completion() { COMPREPLY=( $( env
> COMP_WORDS="${COMP_WORDS[*]}" \ COMP_CWORD=$COMP_CWORD \
> _MOLECULE_COMPLETE=complete $1 ) ) return 0 } complete
> -F _molecule_completion -o default molecule;
> ^
> from sourcing file -
> called on line 60 of file /usr/share/fish/functions/eval.fish
>
> in function “eval”
> called on line 3 of file ~/.config/fish/completions/molecule.fish
>
> from sourcing file ~/.config/fish/completions/molecule.fish
> called on standard input
>
> in command substitution
> called on standard input
>
> source: Error while reading file “-”
>
>
> Do you have any idea to suggest ? Does it come from my completion command
> in molecule.fish ?
>
> Thanks for your time :).
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Fish-users mailing list
> Fish-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/fish-users
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Fish-users mailing list
Fish-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fish-users