Skip to content

Commit 9781fac

Browse files
committed
bash-completion: improve compatibility with zsh
When running bash-completion's completion functions in zsh, the `_init_completion` and `_get_first_arg` functions are not defined in `bashcompinit`. Defining dummy functions allow using auto-completion in zsh although its not as accurate. Without _get_first_arg, the completion doesn't detail the options specific to that command and lists all of them.
1 parent a9f3225 commit 9781fac

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

bash-completion

+7
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@
1515
# You should have received a copy of the GNU General Public License
1616
# along with this program. If not, see <http://www.gnu.org/licenses/>.
1717

18+
if [ -z "$BASH_VERSION" ]; then
19+
_init_completion() {
20+
}
21+
_get_first_arg() {
22+
}
23+
fi
24+
1825
_cqfd() {
1926
local cur prev words cword
2027
_init_completion || return

0 commit comments

Comments
 (0)