From 7b9dafb9e4d10a68eb5df99398e6a0c0e6209dd5 Mon Sep 17 00:00:00 2001 From: Fabian Boehm Date: Sat, 15 Jul 2023 14:24:35 +0200 Subject: [PATCH] completions/rclone: Add version parsing This had a weird, unnecessary and terrible backwards-incompatibility in how you get the completions out. I do not like it but I am in a good enough mood to work around it. See #9878. (cherry picked from commit bfd97adbda451a5acc1c4d1c39a335dd00475f5d) --- share/completions/rclone.fish | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/share/completions/rclone.fish b/share/completions/rclone.fish index 9a2fb6122..744bb7051 100644 --- a/share/completions/rclone.fish +++ b/share/completions/rclone.fish @@ -1 +1,10 @@ -rclone completion fish - | source +set -l rclone_version (rclone version | string match -rg 'rclone v(.*)' | string split .) +or return + +# Yes, rclone's parsing here has changed, now they *require* a `-` argument +# where previously they required *not* having it. +if test "$rclone_version[1]" -gt 1; or test "$rclone_version[2]" -gt 62 + rclone completion fish - 2>/dev/null | source +else + rclone completion fish 2>/dev/null | source +end