add script gsuggest.pl - google suggest
authorMichael Prokop <mika@grml.org>
Wed, 10 Jan 2007 22:51:01 +0000 (23:51 +0100)
committerMichael Prokop <mika@grml.org>
Wed, 10 Jan 2007 22:51:01 +0000 (23:51 +0100)
debian/changelog
debian/rules
manpages/gsuggest.1 [new file with mode: 0644]
usr_bin/gsuggest.pl [new file with mode: 0755]

index d86969f..305d933 100644 (file)
@@ -1,3 +1,10 @@
+grml-scripts (0.9.11) unstable; urgency=low
+
+  * Added script gsuggest.pl: google suggest - ask google for
+    keyword suggestions
+
+ -- Michael Prokop <mika@grml.org>  Wed, 10 Jan 2007 23:49:16 +0100
+
 grml-scripts (0.9.10) unstable; urgency=low
 
   * grml-slrn: do not activate 'set charset isolatin' and
index eb2ba59..15aba17 100755 (executable)
@@ -55,7 +55,7 @@ binary-arch: build install
        dh_installdocs
        dh_installman manpages/grml-scripts.1 manpages/grml-bind.8 manpages/reread_partition_table.8 manpages/gtf.1 manpages/random-hostname.1 \
        manpages/grml-setkeyboard.8 manpages/grml-setlang.8 manpages/getsf.1 manpages/grml-iptstate.8 manpages/qma.1 manpages/grml-swapon.8 \
-       manpages/grml2ram.8
+       manpages/grml2ram.8 manpages/gsuggest.1
 #      cp --no-dereference man/*.1.gz debian/grml-scripts/usr/share/man/man1/
        dh_link /usr/sbin/blacklist /usr/sbin/unblacklist \
                /usr/share/man/man1/grml-scripts.1.gz /usr/share/man/man1/align.1.gz \
diff --git a/manpages/gsuggest.1 b/manpages/gsuggest.1
new file mode 100644 (file)
index 0000000..0be7cc0
--- /dev/null
@@ -0,0 +1,24 @@
+.TH gsuggest.pl 1
+gsuggest.pl \- google suggest, ask google for keyword suggestions
+.SH SYNOPSIS
+.B gsuggest.pl
+.RI keyword " [ another-keyword ]"
+.SH DESCRIPTION
+This manual page documents briefly the
+.B gsuggest.pl
+command.
+.PP
+\fBgsuggest.pl\fP is a program that asks google for keyword suggestions
+for the given keyword[s].
+.SH USAGE EXAMPLE
+.TP
+.B gsuggest.pl grml
+This will ask google for keyword suggestions based on the keyword 'grml'
+and will return the results to standard out (stdout).
+.SH OPTIONS
+gsuggest.pl does not support any options.
+.SH AUTHOR
+gsuggest.pl was written by Michael Prokop <mika@grml.org>.
+.PP
+This manual page was written by Michael Prokop <mika@grml.org>
+for the Debian project (but may be used by others).
diff --git a/usr_bin/gsuggest.pl b/usr_bin/gsuggest.pl
new file mode 100755 (executable)
index 0000000..24af6be
--- /dev/null
@@ -0,0 +1,28 @@
+#!/usr/bin/perl
+# Filename:      gsuggest.pl
+# Purpose:       google suggest - ask google for keyword suggestions
+# Authors:       grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
+# Bug-Reports:   see http://grml.org/bugs/
+# License:       This file is licensed under the GPL v2.
+# Latest change: Mit Jän 10 23:40:04 CET 2007 [mika]
+################################################################################
+
+use strict;
+use warnings;
+use WebService::Google::Suggest;
+
+unless (@ARGV) {
+  print "usage: gsuggest <keyword[s]>\n";
+  exit(1);
+}
+
+my $suggest = WebService::Google::Suggest->new();
+
+while (@ARGV) {
+   my @suggestions = $suggest->complete(shift);
+   for my $suggestion (@suggestions) {
+     print "$suggestion->{query}: $suggestion->{results} results\n";
+   }
+}
+
+## END OF FILE #################################################################