Skip to content

Commit

Permalink
lilo: don't complete on commented out labels
Browse files Browse the repository at this point in the history
Closes #369

Thanks-to: PauloHFB
  • Loading branch information
scop committed Dec 7, 2019
1 parent 5b12f1d commit ad6a349
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion completions/lilo
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

_lilo_labels()
{
COMPREPLY=( $(compgen -W "$(awk -F'=' '/label/ {print $2}' \
COMPREPLY=( $(compgen -W "$(awk -F= '$1 ~ /^[ \t]*label$/ {print $2}' \
${1:-/etc/lilo.conf} 2>/dev/null | command sed -e 's/\"//g')" \
-- "$cur") )
}
Expand Down
4 changes: 2 additions & 2 deletions test/fixtures/lilo/lilo.conf
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ menu-title=" John's Computer "
image=/boot/vmlinuz-2.6.29-1-i386
label=try
initrd=/boot/initrd.img-2.6.29-1-i386
image=/boot/vmlinuz-2.4.33-1-i386
label=2.4.33
#image=/boot/vmlinuz-2.4.33-1-i386
# label=2.4.33
image=/tamu/vmlinuz
label=tamu
initrd=/tamu/initrd.img
Expand Down
5 changes: 2 additions & 3 deletions test/t/test_lilo.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ def test_1(self, completion):

@pytest.mark.complete("lilo -C lilo/lilo.conf -D ")
def test_labels(self, completion):
assert completion == sorted(
"try 2.4.33 tamu PCDOS WinXP oldDOS".split()
)
# Note that 2.4.33 should not be here, it's commented out
assert completion == sorted("try tamu PCDOS WinXP oldDOS".split())

@pytest.mark.complete("lilo -C -D ")
def test_labels_incorrect_command(self, completion):
Expand Down

0 comments on commit ad6a349

Please sign in to comment.