aboutsummaryrefslogtreecommitdiff
path: root/elvi
diff options
context:
space:
mode:
Diffstat (limited to 'elvi')
-rwxr-xr-xelvi/repology41
-rwxr-xr-xelvi/sbo88
-rwxr-xr-xelvi/slack205
-rwxr-xr-xelvi/wikiquote48
4 files changed, 0 insertions, 382 deletions
diff --git a/elvi/repology b/elvi/repology
deleted file mode 100755
index 7e78c26..0000000
--- a/elvi/repology
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/bin/sh
-
-# elvis: repology -- Search Linux distro package metadata with repology.org
-
-. surfraw || exit 1
-
-w3_usage_hook() {
- cat <<EOF
-Usage: $w3_argv0 [options] [search words]...
-Description:
- Surfraw search Linux distro package metadata
-Local options:
- -p,-pkg,-package Search package names
- -m,-maint Search maintainers by email address
-By default, if there's an @ in the search term, a maintainer search is done,
-otherwise a package search.
-EOF
- w3_global_usage
-}
-
-w3_parse_option_hook() {
- opt="$1"
- optarg="$2"
- case "$opt" in
- -p|-pkg|-pac*) repo_target="/projects/" ;;
- -m|-main*) repo_target="/maintainers/" ;;
- *) return 1 ;;
- esac
- return 0
-}
-
-w3_config
-w3_parse_args "$@"
-
-[ -z "$repo_target" ] && case "$w3_args" in
- *@*) repo_target="/maintainers/" ;;
- *) repo_target="/projects/" ;;
-esac
-
-url="https://repology.org/${repo_target}?search=$( w3_url_of_arg $w3_args )";
-w3_browse_url "$url"
diff --git a/elvi/sbo b/elvi/sbo
deleted file mode 100755
index fdc895e..0000000
--- a/elvi/sbo
+++ /dev/null
@@ -1,88 +0,0 @@
-#!/bin/sh
-
-# elvis: sbo -- Search SlackBuilds.org packages
-
-# Author: B. Watson (yalhcru at gmail)
-# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
-
-. surfraw || exit 1
-
-if [ "$( type -p wget )" = "" ]; then
- err "wget is required for this. please install it."
-fi
-
-get_slack_ver() {
- local ver sitevers topver i
-
- # initially set to the currently running version, if we can
- if [ -e /etc/slackware-version ]; then
- ver="$( cut -d' ' -f2 < /etc/slackware-version )"
- fi
-
- # now check the site, make sure it's a supported version (e.g. not -current)
- sitevers="$(
- wget -qO- "https://slackbuilds.org" | \
- grep -A1 '<select *name="sv"' | \
- tail -1 | \
- sed \
- -e 's,^[[:space:]]*,,' \
- -e 's,<option value="[^"]*"[^>]*>\([0-9][^"]*\)</option>,\1 ,g' \
- -e 's,[[:space:]]*</select>.*,,'
- )"
-
- # if we can't get the local version *or* the list of versions
- # from the site, just take a wild guess.
- if [ -z "$sitevers" ]; then
- echo "${ver:-14.2}"
- return
- fi
-
- for i in $sitevers; do
- topver="$i"
- if [ "$i" = "$ver" ]; then
- echo "$ver"
- return
- fi
- done
-
- # fall back to the highest-numbered version on the site
- echo "$topver"
- return
-}
-
-w3_config_hook() {
- def SURFRAW_slack_version "$( get_slack_ver )"
-}
-
-w3_usage_hook() {
- cat <<EOF
-Usage: $w3_argv0 [options] [search words]...
-Description:
- Surfraw search packages on SlackBuilds.org
-Local options:
- -ver=VERSION Slackware version (Currently $SURFRAW_slack_version)
-EOF
- w3_global_usage
-}
-
-w3_parse_option_hook() {
- opt="$1"
- optarg="$2"
-
- case "$opt" in
- -v*=*) setopt SURFRAW_slack_version "$optarg" ;;
- *) return 1 ;;
- esac
-
- return 0
-}
-
-w3_config
-w3_parse_args "$@"
-
-# example URL:
-# http://slackbuilds.org/result/?search=test&sv=14.2
-
-escaped_args="$( w3_url_of_arg $w3_args )"
-url="https://slackbuilds.org/result/?search=${escaped_args}&sv=${SURFRAW_slack_version}"
-w3_browse_url "$url"
diff --git a/elvi/slack b/elvi/slack
deleted file mode 100755
index d3e2e7d..0000000
--- a/elvi/slack
+++ /dev/null
@@ -1,205 +0,0 @@
-#!/bin/sh
-
-# elvis: slack -- Search Slackware.com packages
-
-# Author: B. Watson (yalhcru at gmail)
-# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
-
-# Unfortunately we can't use get with this form. Well, we can,
-# except the checkboxes for "search sets" don't work. So it has
-# to be a post request, which means this elvis depends on wget. I
-# suppose it could support curl instead (or in addition) but I don't
-# see the point.
-
-# The source search is pretty useless, but that's not this script's fault.
-
-. surfraw || exit 1
-
-if [ "$( type -p wget )" = "" ]; then
- err "wget is required for this. please install it."
-fi
-
-get_slack_ver() {
- local ver sitevers i
-
- # initially set to the currently running version, if we can.
- # unfortunately, this can be wrong: if someone upgraded to -current
- # but didn't upgrade aaa_base, it'll still say 14.2 (or whatever they
- # upgraded from).
- if [ -e /etc/slackware-version ]; then
- ver="$( cut -d' ' -f2 < /etc/slackware-version )"
- else
- # we're not on slackware, assume current
- echo "current"
- return
- fi
-
- # now check the site, make sure it's a supported version
- # TODO: rewrite to use sed or awk? maybe not that big a deal.
- sitevers="$(
- wget -qO- "https://packages.slackware.com" | \
- perl -ne 'print "$1 " while (/<option value="slackware-([\d.]+)"/go)'
- )"
-
- # if we can't get the the list of versions from the site, use contents
- # of slackware-version, or current if we ain't got one. probably doesn't
- # matter, if the site is broken.
- if [ -z "$sitevers" ]; then
- echo "${ver:-current}"
- return
- fi
-
- # if it's a supported version, use it
- for i in $sitevers; do
- if [ "$i" = "$ver" ]; then
- echo "$ver"
- return
- fi
- done
-
- # fall back to current
- echo "current"
- return
-}
-
-get_slack_arch() {
- case "$( uname -m )" in
- x86_64) SURFRAW_slack_arch="64" ;;
- *) SURFRAW_slack_arch="" ;;
- esac
- echo "$SURFRAW_slack_arch"
-}
-
-w3_config_hook() {
- def SURFRAW_slack_ver "$( get_slack_ver )"
- def SURFRAW_slack_arch "$( get_slack_arch )"
- def SURFRAW_slack_mode "package"
- def SURFRAW_slack_sets "eps"
-}
-
-w3_usage_hook() {
- local defarch
- [ "$SURFRAW_slack_arch" = 64 ] && defarch=64 || defarch=32
- cat <<EOF
-Usage: $w3_argv0 [options] [search words]...
-Description:
- Surfraw search Slackware.com packages
-Local options:
- -v=<version> Slackware version (default $SURFRAW_slack_ver).
- For .0 releases, include the .0 (eg 14.0, not 14).
- -C, -cur Same as -v=current
- -32/-i586, -64/-x86_64 Architecture (default -$defarch)
- -pa, -pkg, -P Package search (default)
- -d, -desc Description search
- -l, -label Label search
- -c, -content Content search
- -s=<sets> Search sets, <sets> may consist of:
- e = extra
- P = pasture
- p = patches
- s = slackware
- S = source
- t = testing
- Default: $SURFRAW_slack_sets
- -S, -src Search source (same as -c -sS)
- -a, -all Search all sets (same as -s=ePpsSt)
-Notes:
- - Default version and architecture read from the OS (/etc/slackware-version
- and uname -m). You can hardcode them in ~/.config/surfraw/conf (see below).
- - Search modes: "package" looks at package names, "description"
- looks at the .txt files named after the packages (created from the
- slack-desc), "label" looks at the first line of .txt file, and "content"
- looks at the contents of packages.
- - "content" searches are for finding out which package a file belongs to.
- Be aware that symlinks aren't found by this, although if the symlink
- exists on the local system, its target will be used instead.
- - The source search is basically useless without "content" mode. Actually
- it's pretty useless anyway.
- - Defaults can be set in the config file "~/.config/surfraw/conf". Example:
-SURFRAW_slack_ver=14.2
-SURFRAW_slack_arch=64
-SURFRAW_slack_mode=package
-SURFRAW_slack_sets=eps
- For 32-bit architecture (i586), use:
-SURFRAW_slack_arch=""
- In other words do NOT set it to 32, the only valid values
- are "64" and "".
-EOF
- w3_global_usage
-}
-
-# have to use -pa/-pkg/-P for "package", not -p as it conflicts with
-# the global -p/-print
-# -v=<version> does NOT conflict with global -version
-w3_parse_option_hook() {
- opt="$1"
- optarg="$2"
- case "$opt" in
- -v*=*) SURFRAW_slack_ver="$optarg" ;;
- -C*|-cur*) SURFRAW_slack_ver="current" ;;
- -32|-i?86) SURFRAW_slack_arch="" ;;
- -64|x86_64) SURFRAW_slack_arch="64" ;;
- -pa*|-pk*|-P) SURFRAW_slack_mode="package" ;;
- -d*) SURFRAW_slack_mode="description" ;;
- -l*) SURFRAW_slack_mode="label" ;;
- -c*) SURFRAW_slack_mode="content" ;;
- -s*=*) SURFRAW_slack_sets="$optarg" ;;
- -S*|-src*) SURFRAW_slack_sets="S"
- SURFRAW_slack_mode="content" ;;
- -a*) SURFRAW_slack_sets="ePpsSt" ;;
- *) return 1 ;;
- esac
- return 0
-}
-
-w3_config
-w3_parse_args "$@"
-
-url="https://packages.slackware.com/"
-
-# try to make content search more user-friendlier.
-if [ "$SURFRAW_slack_mode" = "content" ]; then
- if echo "$w3_args" | grep -q ^/; then
- # resolve symlink, if possible
- w3_args_new="$( readlink -e "$w3_args" )"
- [ -n "$w3_args_new" ] && w3_args="$w3_args_new"
- # remove leading /'s since the form fails with them
- w3_args="$( echo "$w3_args" | sed 's,^/*,,' )"
- fi
-fi
-
-postdata="search=$( w3_url_of_arg $w3_args )"
-postdata="${postdata}&release=slackware${SURFRAW_slack_arch}-${SURFRAW_slack_ver}"
-postdata="${postdata}&mode=${SURFRAW_slack_mode}"
-
-# Pick apart sets. Might be a cleaner way to do this.
-sets="$( echo "$SURFRAW_slack_sets" | sed 's,\(.\),\1 ,g' )"
-for i in $sets; do
- case "$i" in
- e) postdata="${postdata}&extra=on" ;;
- P) postdata="${postdata}&pasture=on" ;;
- p) postdata="${postdata}&patches=on" ;;
- s) postdata="${postdata}&slackware=on" ;;
- S) postdata="${postdata}&source=on" ;;
- t) postdata="${postdata}&testing=on" ;;
- *) err "invalid -s arg '$i'." ;;
- esac
-done
-
-# hardcode number of results, more is always better, right?
-postdata="${postdata}&result=1000"
-
-# wget should be quiet unless -print is enabled.
-[ "$SURFRAW_print" = "yes" ] || Q="-q"
-
-# do the post, show the results.
-# all the image, css, js URLs are absolute paths so they'll load OK.
-# the "Packages" and form target URLs are relative, so fix them with sed.
-
-dir="$( mktemp -td sr.slack.XXXXXX )"
-[ -d $dir ] || exit 1
-wget $Q -O $dir/slack.html --post-data="$postdata" $url
-sed -i "s,= *\"[./]\",=\"$url\",g" $dir/slack.html
-w3_browse_url "file://$dir/slack.html"
-[ "$SURFRAW_print" = "yes" ] && echo "POST data: $postdata"
-rm -rf $dir
diff --git a/elvi/wikiquote b/elvi/wikiquote
deleted file mode 100755
index 6e91ffb..0000000
--- a/elvi/wikiquote
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/bin/sh
-
-# elvis: wikiquote -- Search literary/film quotations on wikiquote.org
-
-. surfraw || exit 1
-
-default_lang="en"
-
-w3_config_hook() {
- def SURFRAW_wikiquote_language "$SURFRAW_lang"
-}
-
-w3_usage_hook() {
- cat <<EOF
-Usage: $w3_argv0 [options] [search words]...
-Description:
- Surfraw search quotations on wikiquote.org
-Local options:
- -language=ISOCODE | -l=ISOCODE Two letter language code (resembles ISO country codes)
- Default: $default_lang
- Environment: SURFRAW_wikiquote_language, SURFRAW_lang
-EOF
- w3_global_usage
-}
-
-w3_parse_option_hook() {
- opt="$1"
- optarg="$2"
- case "$opt" in
- -l*=*) SURFRAW_wikiquote_language="$optarg" ;;
- *) return 1 ;;
- esac
- return 0
-}
-
-w3_config
-w3_parse_args "$@"
-
-[ -z "$SURFRAW_wikiquote_language" ] && \
- SURFRAW_wikiquote_language="$default_lang"
-
-url="https://${SURFRAW_wikiquote_language}.wikiquote.org"
-if ! null "$w3_args"; then
- url="$url/w/index.php"
- url="$url?search=$( w3_url_of_arg $w3_args )"
- url="$url&title=Special%3ASearch&fulltext=Search&ns0=1"
-fi
-w3_browse_url "$url"