From 1c3a8e0e11865da759e9c807095db8c7cea9a7ba Mon Sep 17 00:00:00 2001 From: NextAlone <12210746+NextAlone@users.noreply.github.com> Date: Sun, 26 Jun 2022 03:59:18 +0800 Subject: [PATCH] feat: completion for reflector (#9027) (cherry picked from commit 5642499dc2a4fc7763e520722f5ca4e6ba2db077) --- CHANGELOG.rst | 2 +- share/completions/reflector.fish | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 share/completions/reflector.fish diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 71462e28a..c69532f3d 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,7 +5,7 @@ This release of fish introduces the following small enhancements: - Cursor shaping for Vi mode is enabled by default in tmux, and will be used if the outer terminal is capable (:issue:`8981`). - ``printf`` returns a better error when used with arguments interpreted as octal numbers (:issue:`9035`). -- Improvements to some completions. +- New completions for ``reflector`` (:issue:`9027`) and improvements to some completions. This release also fixes a number of problems identified in fish 3.5.0. diff --git a/share/completions/reflector.fish b/share/completions/reflector.fish new file mode 100644 index 000000000..0a833ea3d --- /dev/null +++ b/share/completions/reflector.fish @@ -0,0 +1,30 @@ +complete -c reflector -f +# options +complete -c reflector -s h -l help -d 'Show help' +complete -c reflector -l connection-timeout -d 'The number of seconds to wait before a connection times out' +complete -c reflector -l download-timeout -d 'The number of seconds to wait before a download times out' +complete -c reflector -l list-countries -d 'Display a table of the distribution of servers by country' +complete -c reflector -l cache-timeout -d 'The cache timeout in seconds for the data retrieved from the Arch Linux Mirror Status API' +complete -c reflector -l url -d 'The URL from which to retrieve the mirror data in JSON format' +complete -c reflector -l save -d 'Save the mirrorlist to the given path' +complete -c reflector -l sort -d 'Sort the mirrorlist' -xa 'age rate country score delay' +complete -c reflector -l threads -d 'The number of threads to use for downloading' +complete -c reflector -l verbose -d 'Print extra information' +complete -c reflector -l info -d 'Print mirror information instead of a mirror list' + +# filters +complete -c reflector -s a -l age -d 'Only return mirrors that have synchronized in the last n hours' +complete -c reflector -l delay -d 'Only return mirrors with a reported sync delay of n hours or less, where n is a float' +complete -c reflector -s c -l country -d 'Restrict mirrors to selected countries' -xa "(reflector --list-countries | cut -f 1 -d ' ' | tail -n +3)" +complete -c reflector -s f -l fastest -d 'Return the n fastest mirrors that meet the other criteria' +complete -c reflector -s i -l include -d 'Include servers that match ' +complete -c reflector -s x -l exclude -d 'Exclude servers that match ' +complete -c reflector -s l -l latest -d 'Limit the list to the n most recently synchronized servers' +complete -c reflector -l score -d 'Limit the list to the n servers with the highest score' +complete -c reflector -s n -l number -d 'Return at most n mirrors' +complete -c reflector -s p -l protocol -d 'Match one of the given protocols' -xa 'http https ftp rsync' +complete -c reflector -l completion-percent -d 'Set the minimum completion percent for the returned mirrors' +complete -c reflector -l isos -d 'Only return mirrors that host ISOs' +complete -c reflector -l ipv4 -d 'Only return mirrors that support IPv4' +complete -c reflector -l ipv6 -d 'Only return mirrors that support IPv6' +