Skip to content

shovel: New completion #279

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions completions/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ bashcomp_DATA = 2to3 \
screen \
scrub \
sh \
shovel \
sitecopy \
slackpkg \
slapt-get \
Expand Down
22 changes: 22 additions & 0 deletions completions/shovel
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# shovel completion

_shovel()
{
local cur prev words cword
_init_completion || return

case $prev in
--help|--version|-!(-*)[h])
return
;;
esac

if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '$( _parse_help "$1" --help )' -- "$cur" ) )
elif [[ -f shovel.py || -d shovel ]]; then
COMPREPLY=( $( compgen -W '$(shovel tasks | cut -s -d"#" -f1) help tasks' -- "$cur") )
fi
} &&
complete -F _shovel shovel

# ex: filetype=sh
1 change: 1 addition & 0 deletions test/t/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,7 @@ EXTRA_DIST = \
test_sha1sum.py \
test_shar.py \
test_sh.py \
test_shovel.py \
test_sitecopy.py \
test_slackpkg.py \
test_slapt_get.py \
Expand Down
12 changes: 12 additions & 0 deletions test/t/test_shovel.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import pytest


class TestShovel:

@pytest.mark.complete("shovel ")
def test_1(self, completion):
assert completion

@pytest.mark.complete("shovel --")
def test_2(self, completion):
assert completion