[Surfraw-devel] A handful of tiny patches
Ivy Foster
joyfulgirl at archlinux.us
Sat Mar 17 20:52:18 UTC 2012
Howdy, folks.
Submitted for your approval: I have three quick patches for
you.
The first sets https to be the default protocol when using
the aur elvis; it's the new recommended practice. The patch
also adds an option to use plain http, instead.
The second patch changes the argument parsing slightly for
duckduckgo; before, `-lh' was interpreted as `-lucky'
(matched as `-l*'); now, ddg checks for `-l|-lu*'.
The third and final fixes a typo in duckduckgo; the
lucky/ducky search had a space instead of an underscore in
${escaped_args}, causing an error to be printed.
Thanks,
iff
P.S.: I've attached the patches; alternately, you can pull
them from git://github.com/escondida/surfraw.git.
-------------- next part --------------
>From 1531bef83538cd54f8df7f8900d457b0aeeda844 Mon Sep 17 00:00:00 2001
From: Ivy Foster <joyfulgirl at archlinux.us>
Date: Tue, 10 Jan 2012 13:50:47 -0500
Subject: [PATCH 1/3] elvi/aur now uses HTTPS by default.
- On the AUR, connecting via HTTP disables login.
- Added switch -no-https to enable connection via plain HTTP
---
elvi/aur | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/elvi/aur b/elvi/aur
index 77a2ee3..b51c4c9 100755
--- a/elvi/aur
+++ b/elvi/aur
@@ -14,6 +14,7 @@ w3_config_hook () {
def SURFRAW_aur_order "a"
def SURFRAW_aur_language en
defyn SURFRAW_aur_outdated 0
+ def SURFRAW_aur_protocol "https"
def SURFRAW_aur_results "$SURFRAW_results"
def SURFRAW_aur_search name
def SURFRAW_aur_sort name
@@ -32,6 +33,9 @@ Local options
-language Search in your your language
See aur.archlinux.org for available languages
Default: en
+ -no-https Connect using HTTP, rather than HTTPS.
+ This disables logging in.
+ Default: use $SURFRAW_aur_protocol
-order=ascending|descending Organize in ascending or descending order
Default: ascending
-orphans Search orphaned packages
@@ -62,6 +66,7 @@ w3_parse_option_hook () {
case "$opt" in
-category=*) setopt SURFRAW_aur_category "$optarg" ;;
-language=*) setopt SURFRAW_aur_language "$optarg" ;;
+ -no-https) setopt SURFRAW_aur_protocol "http" ;;
-orphans*) setopt SURFRAW_aur_action "Orphans=Orphans" ;;
-order=d*) setopt SURFRAW_aur_order d ;;
-order=*) setopt SURFRAW_aur_order a ;;
@@ -130,12 +135,12 @@ esac
# w3_args now contains a list of arguments
if test -z "$w3_args" && test "$SURFRAW_aur_action" = "Search=Go"; then
- w3_browse_url "http://aur.archlinux.org/packages.php?setlang=${aur_lang}"
+ w3_browse_url "${SURFRAW_aur_protocol}://aur.archlinux.org/packages.php?setlang=${aur_lang}"
else
escaped_args=`w3_url_of_arg $w3_args`
if [ "$SURFRAW_aur_outdated" = 1 ]; then
- w3_browse_url "http://aur.archlinux.org/packages.php?O=0&L=0&detail=1&C=${aur_category}&K=${escaped_args}&SeB=${aur_search_by}&SB=${aur_sort_by}&SO=${SURFRAW_aur_order}&PP=${SURFRAW_aur_results}&do_${SURFRAW_aur_action}&outdated=on&setlang=${aur_lang}"
+ w3_browse_url "${SURFRAW_aur_protocol}://aur.archlinux.org/packages.php?O=0&L=0&detail=1&C=${aur_category}&K=${escaped_args}&SeB=${aur_search_by}&SB=${aur_sort_by}&SO=${SURFRAW_aur_order}&PP=${SURFRAW_aur_results}&do_${SURFRAW_aur_action}&outdated=on&setlang=${aur_lang}"
else
- w3_browse_url "http://aur.archlinux.org/packages.php?O=0&L=0&detail=1&C=${aur_category}&K=${escaped_args}&SeB=${aur_search_by}&SB=${aur_sort_by}&SO=${SURFRAW_aur_order}&PP=${SURFRAW_aur_results}&do_${SURFRAW_aur_action}&setlang=${aur_lang}"
+ w3_browse_url "${SURFRAW_aur_protocol}://aur.archlinux.org/packages.php?O=0&L=0&detail=1&C=${aur_category}&K=${escaped_args}&SeB=${aur_search_by}&SB=${aur_sort_by}&SO=${SURFRAW_aur_order}&PP=${SURFRAW_aur_results}&do_${SURFRAW_aur_action}&setlang=${aur_lang}"
fi
fi
--
1.7.9.4
-------------- next part --------------
>From 7ccb766498674284dcb383dded9e178a01de6a02 Mon Sep 17 00:00:00 2001
From: Ivy Foster <joyfulgirl at archlinux.us>
Date: Sat, 17 Mar 2012 16:21:06 -0400
Subject: [PATCH 2/3] Keep duckduckgo's -l[ucky] from clobbering -lh
---
elvi/duckduckgo | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/elvi/duckduckgo b/elvi/duckduckgo
index 8487694..b8372b6 100755
--- a/elvi/duckduckgo
+++ b/elvi/duckduckgo
@@ -36,7 +36,7 @@ w3_parse_option_hook () {
opt="$1"
optarg="$2"
case "$opt" in
- -d*|-l*) setoptyn SURFRAW_duckduckgo_got_a_ducky_feeling 1 ;;
+ -d*|-l|-lu*) setoptyn SURFRAW_duckduckgo_got_a_ducky_feeling 1 ;;
-j|-javascript*) setoptyn SURFRAW_duckduckgo_use_javascript 1 ;;
-p|-safe*) setoptyn SURFRAW_duckduckgo_safe_arg 1 ;;
-r|-redirect*) setoptyn SURFRAW_duckduckgo_redirect_arg 1 ;;
--
1.7.9.4
-------------- next part --------------
>From 825876b5a504ed2ec01053283a400fa897f06508 Mon Sep 17 00:00:00 2001
From: Ivy Foster <joyfulgirl at archlinux.us>
Date: Sat, 17 Mar 2012 16:46:22 -0400
Subject: [PATCH 3/3] Fix a typo in duckduckgo code.
---
elvi/duckduckgo | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/elvi/duckduckgo b/elvi/duckduckgo
index b8372b6..9f82ff2 100755
--- a/elvi/duckduckgo
+++ b/elvi/duckduckgo
@@ -76,7 +76,7 @@ fi
escaped_args=`w3_url_of_arg $w3_args`
if [ "$SURFRAW_duckduckgo_got_a_ducky_feeling" = 1 ]; then
- escaped_args="! ${escaped args}"
+ escaped_args="! ${escaped_args}"
fi
w3_browse_url "${SURFRAW_duckduckgo_base_url}/?q=${escaped_args}${SURFRAW_duckduckgo_params}"
--
1.7.9.4
More information about the Surfraw-devel
mailing list