Support search queries that start with a dash

Example: 'saury -As -- -hg'
This commit is contained in:
Les De Ridder 2019-03-26 03:44:05 +01:00
parent 899ba881a6
commit 86d1942d74
1 changed files with 7 additions and 7 deletions

14
saury
View File

@ -70,7 +70,7 @@ end
function aur_search
set query $argv
if test (string length "$query") -lt 2
if test (string length -- "$query") -lt 2
error "search query must be at least 2 characters long"
end
@ -100,11 +100,11 @@ function aur_search
set popularity $results[(math $i \* 7)]
set_color --bold
echo -n (string join "" \
echo -n (string join -- "" \
(set_color CC3399) "aur/" \
(set_color normal; set_color --bold) (string replace -a -i \
(set_color normal; set_color --bold) (string replace -a -i -- \
"$query" \
(string join "" (set_color 33CCB3) \
(string join -- "" (set_color 33CCB3) \
"$query" \
(set_color normal; set_color --bold)) \
"$name"))
@ -123,7 +123,7 @@ function aur_search
echo -n " ($package_base)"
end
echo -n (string join "" \
echo -n (string join -- "" \
(set_color normal; set_color --bold) ' (' \
(set_color CC6733) "+$votes" \
(set_color normal; set_color --bold) ' | ' \
@ -149,9 +149,9 @@ function aur_search
echo
set_color normal
echo (string replace -a -i \
echo (string replace -a -i -- \
"$query" \
(string join "" (set_color 33CCB3) \
(string join -- "" (set_color 33CCB3) \
"$query" \
(set_color normal)) \
" $description")