diff options
Diffstat (limited to 'sbo')
-rwxr-xr-x | sbo | 27 |
1 files changed, 22 insertions, 5 deletions
@@ -58,10 +58,20 @@ w3_usage_hook() { cat <<EOF Usage: $w3_argv0 [options] [search words]... Description: - Surfraw search packages on SlackBuilds.org + Surfraw search builds/maintainers/dependencies on SlackBuilds.org Local options: -ver=VERSION Slackware version (Currently $SURFRAW_slack_version) + -m Maintainer search (name or email) + -r Reverse dependency search + -u URL search (download/homepage) +Notes: +-ver is ignored with -m, -r, -u (only latest stable is supported) +If -m is not given, but the search term has an @ in it, it's assumed to be +an email address and -m is enabled. +If -u is not given, but the search term looks like a URL, -u is enabled. EOF +# forward dependency search not yet implemented on site: +# -d Dependency search w3_global_usage } @@ -71,6 +81,8 @@ w3_parse_option_hook() { case "$opt" in -v*=*) setopt SURFRAW_slack_version "$optarg" ;; + -m) stype=maint ;; + -r) stype=revdep ;; *) return 1 ;; esac @@ -79,10 +91,15 @@ w3_parse_option_hook() { w3_config w3_parse_args "$@" - -# example URL: -# http://slackbuilds.org/result/?search=test&sv=14.2 +case "$w3_args" in + *@*) stype=maint ;; + *://*) stype=url ;; +esac escaped_args="$( w3_url_of_arg $w3_args )" -url="https://slackbuilds.org/result/?search=${escaped_args}&sv=${SURFRAW_slack_version}" +if [ "$stype" = "" ]; then + url="https://slackbuilds.org/result/?search=${escaped_args}&sv=${SURFRAW_slack_version}" +else + url="https://slackbuilds.org/advsearch.php?stype=$stype&q=${escaped_args}" +fi w3_browse_url "$url" |