From 382005c33e265cea8ad1e14aefe2d8bacf2669b8 Mon Sep 17 00:00:00 2001 From: NextAlone <12210746+NextAlone@users.noreply.github.com> Date: Sun, 10 Dec 2023 18:40:17 +0800 Subject: [PATCH] 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> --- share/completions/usbip.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/completions/usbip.fish b/share/completions/usbip.fish index fa42129df..750c7aa0a 100644 --- a/share/completions/usbip.fish +++ b/share/completions/usbip.fish @@ -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