Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autocompletion does not work #99

Closed
bep opened this issue Apr 29, 2015 · 10 comments
Closed

Autocompletion does not work #99

bep opened this issue Apr 29, 2015 · 10 comments

Comments

@bep
Copy link
Collaborator

bep commented Apr 29, 2015

Tried to generate Bash autocompletion for Hugo, but gets:

__start_hugo:3: command not found: _init_completion

I don't see _init_completion anywhere in the source.

@bep
Copy link
Collaborator Author

bep commented Apr 29, 2015

@eparis any tips?

@eparis
Copy link
Collaborator

eparis commented Apr 29, 2015

_init_completion is supposed to be included either with bash or with the bash_completions package...

@eparis
Copy link
Collaborator

eparis commented Apr 29, 2015

I guess we need to have it fail silently instead of letting users know they need bash-completions > version 1.90 (I think that's where it was added)

I wouldn't want a noisy failure in a script loaded at login....

@eparis
Copy link
Collaborator

eparis commented Apr 29, 2015

@eparis
Copy link
Collaborator

eparis commented Apr 29, 2015

I could probably switch to _get_comp_words_by_ref which seems to be even older...

_get_comp_words_by_ref: ver 1.2 was June 2010
_init_completion: ver 1.90 was Nov 2011

I'll take suggestions, but it seems to me like Nov 2011 should recent enough support...

@bep
Copy link
Collaborator Author

bep commented Apr 29, 2015

In my case I was trying to get it running under zsh --- It runs fine in bash on my Ubuntu 14.10. I will close this as "my fault".

@bep bep closed this as completed Apr 29, 2015
@eparis
Copy link
Collaborator

eparis commented Apr 29, 2015

I haven't looked at zsh, but it might be relatively easy to support, dunno.....

@marcmo
Copy link

marcmo commented Jul 10, 2015

this also causes problems under Mac OS using brew. The default bash-completion version you get with brew is too old.
Installing the newer version is a no-go for some since it requires to switch to a newer bash version (4.x) but OS X only ships with 3.x.
why not support the older bash-completion? what's the drawback?

~ > bash --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin14)
Copyright (C) 2007 Free Software Foundation, Inc.
~ > brew info bash-completion
bash-completion: stable 1.3 (bottled)
Programmable bash completion
https://bash-completion.alioth.debian.org/
~ > system_profiler SPSoftwareDataType
Software:

    System Software Overview:

      System Version: OS X 10.10.4 (14E46)
      Kernel Version: Darwin 14.4.0

@eparis
Copy link
Collaborator

eparis commented Jul 10, 2015

The only 'drawback' is that I don't have a Mac and don't use 5 year out of date bash-completion. So I don't know how to do it. _init_completion (and in turn __get_comp_words_by_ref) are incredibly complex functions I can't truly understand and so I will not copy them wholesale into our codebase (as then we have to maintain them, and I'm just not up to the task)

If someone writes a 'simple' patch which adds compatibility further back, I'd be REALLY happy to take it. (where simple means I can understand it). I have no idea what is or isn't possible on a mac. Maybe it has _comp_words_by_ref and you can find a way to switch to that directly?

@Pixcell
Copy link

Pixcell commented Aug 2, 2019

In case anyone with mac stumble onto this issue, here is the fix:

apache/openwhisk#2924 (comment)

_get_comp_words_by_ref: command not found

It looks that for Mac users in addition of installing the bash-completion

brew install bash-completion
The user also have to configure bash-completion package in their ~/.bash_profile if they have one or in the ~/.profile
By adding the following

if [ -f $(brew --prefix)/etc/bash_completion ]; then
    . $(brew --prefix)/etc/bash_completion
fi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants