Skip to content

Commit 79fd051

Browse files
committed
fix(ip): Don't offer neighbour, only neighbor
The previous state led to `ip neigh<TAB>` leading to this: ``` $ ip neighbo neighbor neighbour ``` choosing one to complete removes the need to choose between options that do the same thing, aligning with the CONTRIBUTING.md guidelines. I chose `neighbor` because it's shorter, but it can be changed if someone wants to.
1 parent d3ff6a7 commit 79fd051

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

completions/ip

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,9 @@ _comp_cmd_ip()
106106
'/OBJECT := /,/}/!d' -e \
107107
's/.*{//' -e \
108108
's/}.*//' -e \
109-
's/|//g'
110-
)"
109+
's/|//g' -e \
110+
's/neighbour/neighbor/g'
111+
)" # We remove "neighbour" to only leave one option when completing `ip neig`
111112
;;
112113
esac
113114
return

test/t/test_ip.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@ def test_stats(self, completion):
3131
def test_neigh_state(self, completion):
3232
assert "stale" in completion
3333

34+
@pytest.mark.complete(
35+
"ip neig",
36+
require_cmd=True,
37+
skipif="ip neighbor help 2>/dev/null; (( $? != 255 ))",
38+
)
39+
def test_neigh_one_completion(self, completion):
40+
assert len(completion) == 1
41+
3442
@pytest.mark.complete(
3543
"ip monitor ",
3644
require_cmd=True,

0 commit comments

Comments
 (0)