mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 21:03:12 +00:00
7162822486
The version of rclone is set during compilation and could be any crazy string depending on the packager, whether it's a dev build, etc. If it cannot be parsed, let's assume a recent version.
Follows up on cc8fa0f7
14 lines
612 B
Fish
14 lines
612 B
Fish
if set -l rclone_version (rclone version | string match -rg 'rclone v?(.*)' | string split .) &&
|
|
test "$rclone_version[1]" -lt 1 ||
|
|
test "$rclone_version[1]" -eq 1 &&
|
|
test "$rclone_version[2]" -le 62
|
|
# version is definitely <= 1.62, adding a `-` would be an error
|
|
rclone completion fish
|
|
else
|
|
# For newer versions, this requires an `-`. Without a `-`, it would
|
|
# try to write to /etc/completions/fish.
|
|
# If we can't determine the version, assume a recent one. An error
|
|
# is better than trying to write to /etc unexpectedly.
|
|
rclone completion fish -
|
|
end 2>/dev/null | source
|
|
|