Skip to content

Commit 20f5622

Browse files
committed
1 parent b1374fc commit 20f5622

File tree

6 files changed

+24
-0
lines changed

6 files changed

+24
-0
lines changed

completions/Makefile.am

+1
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,7 @@ cross_platform = 2to3 \
404404
sh \
405405
sha256sum \
406406
shellcheck \
407+
_shtab \
407408
sitecopy \
408409
slabtop \
409410
_slackpkg \

completions/_shtab

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# 3rd party completion loader for commands emitting -*- shell-script -*-
2+
# their completion using "$cmd --print-own-completion bash".
3+
# For example, https://github.com/iterative/shtab does.
4+
#
5+
# This serves as a fallback in case the completion is not installed otherwise.
6+
7+
eval -- "$("$1" --print-own-completion bash 2>/dev/null)"
8+
9+
# ex: filetype=sh

test/fallback/completions/shtab

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../completions/_shtab

test/t/Makefile.am

+1
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,7 @@ EXTRA_DIST = \
568568
test_sha512sum.py \
569569
test_shar.py \
570570
test_shellcheck.py \
571+
test_shtab.py \
571572
test_sitecopy.py \
572573
test_slabtop.py \
573574
test_slackpkg.py \

test/t/test_shtab.py

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import pytest
2+
3+
4+
class TestShtab:
5+
@pytest.mark.complete("shtab ", require_cmd=True)
6+
def test_basic(self, completion):
7+
assert not completion
8+
9+
@pytest.mark.complete("shtab -", require_cmd=True)
10+
def test_options(self, completion):
11+
assert completion

test/test-cmd-list.txt

+1
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,7 @@ sha384sum
346346
sha512sum
347347
shar
348348
shellcheck
349+
shtab
349350
sitecopy
350351
slabtop
351352
slapt-get

0 commit comments

Comments
 (0)