Skip to content

Commit 23c8e08

Browse files
authored
Merge pull request #917 from scop/feat/nox-3rdparty
feat(nox): add fallback 3rd party completion loader
2 parents a02a7bc + 5f92486 commit 23c8e08

File tree

4 files changed

+17
-0
lines changed

4 files changed

+17
-0
lines changed

completions/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,7 @@ bashcomp_DATA = 2to3 \
287287
ngrep \
288288
nmap \
289289
_nmcli \
290+
_nox \
290291
nproc \
291292
nslookup \
292293
nsupdate \

completions/_nox

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# 3rd party completion loader for argcomplete commands -*- shell-script -*-
2+
# sourced using no args to `register-python-argcomplete`.
3+
#
4+
# This serves as a fallback in case the completion is not installed otherwise.
5+
6+
eval -- "$(
7+
PATH=$(type -p "$1" 2>/dev/null | command sed 's,/[^/]*$,,')${PATH:+:$PATH}
8+
register-python-argcomplete --shell bash "$1" 2>/dev/null ||
9+
register-python-argcomplete3 --shell bash "$1" 2>/dev/null
10+
)"
11+
12+
complete -p "$1" &>/dev/null
13+
14+
# ex: filetype=sh

test/fallback/completions/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ EXTRA_DIST = \
1818
mount.linux \
1919
newgrp \
2020
nmcli \
21+
nox \
2122
renice \
2223
repomanage \
2324
reptyr \

test/fallback/completions/nox

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../completions/_nox

0 commit comments

Comments
 (0)