Skip to content

Commit e700ae7

Browse files
committed
feat(nload): new completion
1 parent 77d3f1a commit e700ae7

File tree

5 files changed

+42
-0
lines changed

5 files changed

+42
-0
lines changed

completions/Makefile.am

+1
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,7 @@ cross_platform = 2to3 \
300300
newlist \
301301
newusers \
302302
ngrep \
303+
nload \
303304
nmap \
304305
_nmcli \
305306
_nox \

completions/nload

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# bash completion for nload(1) -*- shell-script -*-
2+
3+
_comp_cmd_nload()
4+
{
5+
local cur prev words cword comp_args
6+
_comp_initialize -- "$@" || return
7+
8+
local noargopts='!(-*|*[aiotuU]*)'
9+
case $prev in
10+
--help | -${noargopts}[haiot])
11+
return
12+
;;
13+
-${noargopts}[uU])
14+
_comp_compgen -- -W 'h b k m g H B K M G'
15+
return
16+
;;
17+
esac
18+
19+
if [[ $cur == -* ]]; then
20+
_comp_compgen_help
21+
return
22+
fi
23+
24+
_comp_compgen_available_interfaces
25+
} &&
26+
complete -F _comp_cmd_nload nload
27+
28+
# ex: filetype=sh

test/t/Makefile.am

+1
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,7 @@ EXTRA_DIST = \
418418
test_newusers.py \
419419
test_ngrep.py \
420420
test_nl.py \
421+
test_nload.py \
421422
test_nm.py \
422423
test_nmap.py \
423424
test_nmcli.py \

test/t/test_nload.py

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import pytest
2+
3+
4+
class TestNload:
5+
@pytest.mark.complete("nload ")
6+
def test_basic(self, completion):
7+
assert completion
8+
9+
@pytest.mark.complete("nload -", 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
@@ -243,6 +243,7 @@ newlist
243243
newusers
244244
ngrep
245245
nl
246+
nload
246247
nm
247248
nmap
248249
nproc

0 commit comments

Comments
 (0)