1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
#!/bin/sh
# elvis: sourceforge -- Search SourceForge (www.sourceforge.net)
# $Id$
. surfraw || exit 1
# version 0.2 ianb@erislabs.net 20030910
# added -exact and -type
# version 0.1
# this great work has been achieved by Caiaphas Pechorin (caiaphas@operamail.com)
w3_config_hook () {
defyn SURFRAW_sourceforge_exact no
def SURFRAW_sourceforge_searchtype soft
}
w3_usage_hook () {
cat <<EOF
Usage: $w3_argv0 [options] [search words]...
Description:
Surfraw search SourceForge (www.sourceforge.net)
Local options:
-exact=yes|no Require all words
Default: $SURFRAW_sourceforge_exact
Environment: SURFRAW_sourceforge_exact
-type=
soft | Software / Group
people | People
freshmeat Freshmeat
Default: $SURFRAW_sourceforge_searchtype
Environment: SURFRAW_sourceforge_searchtype
EOF
w3_global_usage
}
w3_parse_option_hook () {
opt="$1"
optarg="$2"
case "$opt" in
-e*=*) setoptyn SURFRAW_sourceforge_exact $optarg ;;
-e*) setoptyn SURFRAW_sourceforge_exact yes ;;
-t*=*) setopt SURFRAW_sourceforge_searchtype $optarg ;;
*) return 1 ;;
esac
return 0
}
w3_config
w3_parse_args "$@"
# w3_args now contains a list of arguments
if test -z "$w3_args"; then
w3_browse_url "https://www.sourceforge.net/"
else
escaped_args=$(w3_url_of_arg $w3_args)
if $(yesno SURFRAW_sourceforge_exact)
then
isexact=1
else
isexact=0
fi
w3_browse_url "https://sourceforge.net/search/?words=${escaped_args}&exact=$isexact&typeofsearch=$SURFRAW_sourceforge_searchtype"
fi
|