diff options
author | B. Watson <yalhcru@gmail.com> | 2020-01-30 13:15:35 -0500 |
---|---|---|
committer | B. Watson <yalhcru@gmail.com> | 2020-01-30 13:15:35 -0500 |
commit | 5201222e2f738c4f7702cfb582f2604c6003d0a8 (patch) | |
tree | dfd8ba0669190f3e61cb8266ec29fb4d1e1bc97b /sbo | |
parent | 8e7fc6daa04b1424b222dbe7eb1b82e601321442 (diff) | |
download | elvi-impersonators-5201222e2f738c4f7702cfb582f2604c6003d0a8.tar.gz |
sbo: support advanced search0.1.0
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" |