Skip to content

Commit

Permalink
fix(available_interfaces): strip only trailing colon from entries
Browse files Browse the repository at this point in the history
Leave other punctuation alone, at least for now.

Closes #1133
  • Loading branch information
scop committed May 7, 2024
1 parent 53fdce4 commit a452aee
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion bash_completion
Original file line number Diff line number Diff line change
Expand Up @@ -1737,7 +1737,7 @@ _comp_compgen_available_interfaces()
fi
} 2>/dev/null | _comp_awk \
'/^[^ \t]/ { if ($1 ~ /^[0-9]+:/) { print $2 } else { print $1 } }')" &&
_comp_compgen -U generated set "${generated[@]%%[[:punct:]]*}"
_comp_compgen -U generated set "${generated[@]%:}"
}

# Echo number of CPUs, falling back to 1 on failure.
Expand Down
2 changes: 1 addition & 1 deletion test/t/unit/test_unit_compgen_available_interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ def test_1_trailing_colons(self, bash, functions):
"_comp__test_compgen available_interfaces",
want_output=True,
)
assert ":" not in output.strip()
assert ":>" not in output.strip()

0 comments on commit a452aee

Please sign in to comment.