From d065ea31a95e1df631f0659e7923f4c9b81af216 Mon Sep 17 00:00:00 2001 From: NextAlone <12210746+NextAlone@users.noreply.github.com> Date: Thu, 29 Sep 2022 09:37:46 +0800 Subject: [PATCH] completion/usbip: don't use old-style completions (#9243) --- share/completions/usbip.fish | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/share/completions/usbip.fish b/share/completions/usbip.fish index 3f27c4a52..a030ac5e9 100644 --- a/share/completions/usbip.fish +++ b/share/completions/usbip.fish @@ -8,35 +8,27 @@ function __fish_usbip_no_subcommand -d 'Test if usbip has yet to be given the su end function __fish_usbip_remote -d 'List remote usbip host' - set -l token (commandline -opc) - if test $token[-1] = -r - set -l remote (ip r | awk '/via/ {print $3"\t"$5}') - for i in $remote - echo $i - end + set -l remote (ip r | awk '/via/ {print $3"\t"$5}') + for i in $remote + echo $i end end function __fish_usbip_busid -d 'List usbip busid' set -l token (commandline -opc) - if test $token[-1] = -b - if contains -- -r $token - set -l remote (commandline -opc | string match -r '([0-9]{1,3}\.){3}[0-9]{1,3}') - set -l busids (usbip list -r $remote 2> /dev/null | string match -r '\d+-\d+') - for i in $busids - echo $i - end + if contains -- -r $token + set -l remote (commandline -opc | string match -r '([0-9]{1,3}\.){3}[0-9]{1,3}') + set -l busids (usbip list -r $remote 2> /dev/null | string match -r '\d+-\d+') + for i in $busids + echo $i end end end function __fish_usbip_busid_attached -d 'List usbip busid attached' - set -l token (commandline -opc) - if test $token[-1] = -p - set -l usbids (usbip port 2> /dev/null | string match -r '(?<=Port\s)(\d+)') - for i in $usbids - echo $i - end + set -l usbids (usbip port 2> /dev/null | string match -r '(?<=Port\s)(\d+)') + for i in $usbids + echo $i end end