Skip to content

Commit

Permalink
fix(ip): Don't offer neighbour, only neighbor
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
yedayak committed Jan 22, 2025
1 parent d3ff6a7 commit 79fd051
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
5 changes: 3 additions & 2 deletions completions/ip
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,9 @@ _comp_cmd_ip()
'/OBJECT := /,/}/!d' -e \
's/.*{//' -e \
's/}.*//' -e \
's/|//g'
)"
's/|//g' -e \
's/neighbour/neighbor/g'
)" # We remove "neighbour" to only leave one option when completing `ip neig`
;;
esac
return
Expand Down
8 changes: 8 additions & 0 deletions test/t/test_ip.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ def test_stats(self, completion):
def test_neigh_state(self, completion):
assert "stale" in completion

@pytest.mark.complete(
"ip neig",
require_cmd=True,
skipif="ip neighbor help 2>/dev/null; (( $? != 255 ))",
)
def test_neigh_one_completion(self, completion):
assert len(completion) == 1

@pytest.mark.complete(
"ip monitor ",
require_cmd=True,
Expand Down

0 comments on commit 79fd051

Please sign in to comment.