completion(usbip): support ipv6 (#10113)

* completion(usbip): support ipv6

Signed-off-by: Next Alone <12210746+NextAlone@users.noreply.github.com>

* completion(usbip): use fish string match

Signed-off-by: Next Alone <12210746+NextAlone@users.noreply.github.com>

* fix: support --remote and -r both

Signed-off-by: Next Alone <12210746+NextAlone@users.noreply.github.com>

---------

Signed-off-by: Next Alone <12210746+NextAlone@users.noreply.github.com>
(cherry picked from commit 382005c33e)
This commit is contained in:
NextAlone 2023-12-10 18:40:17 +08:00 committed by David Adam
parent 25ae69dac1
commit c1f1a92b99

View file

@ -13,7 +13,7 @@ function __fish_usbip_remote -d 'List remote usbip host'
end
function __fish_usbip_busid -d 'List usbip busid'
set -l remote (commandline -opc | string match -r '([0-9]{1,3}\.){3}[0-9]{1,3}')
set -l remote (commandline -opc | string match -r '(?<=-r)(emote)?=?\s*(\S+)' | string trim)
set -l busids (usbip list -r $remote 2> /dev/null | string match -r '\d+-\d+')
printf '%s\n' $busids
end