Skip to content

Commit

Permalink
feat(ip): Create function to get link types
Browse files Browse the repository at this point in the history
Create _comp_cmd_ip__link_types function that gets all the link types
supported by the ip command

Co-Authored-By: Koichi Murase <myoga.murase@gmail.com>
  • Loading branch information
yedayak and akinomyoga committed Mar 10, 2024
1 parent fdd8048 commit 8e60245
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions completions/ip
Expand Up @@ -15,6 +15,19 @@ _comp_cmd_ip__netns()
)"
}

_comp_cmd_ip__link_types()
{
_comp_compgen_split -- "$(
{
${1-ip} -c=never link help || ${1-ip} link help
} 2>&1 | command sed -e \
'/TYPE := /,/}/!d' -e \
's/.*{//' -e \
's/}.*//' -e \
's/|/ /g'
)"
}

_comp_cmd_ip()
{
local cur prev words cword comp_args
Expand Down

0 comments on commit 8e60245

Please sign in to comment.