PATCH: modify send-cluepacket.pl for sending multiple clues
- From: Jamin Philip Gray <jamin pubcrawler org>
- To: dashboard-hackers <dashboard-hackers gnome org>
- Cc: Nat Friedman <nat nat org>
- Subject: PATCH: modify send-cluepacket.pl for sending multiple clues
- Date: Mon, 28 Jul 2003 10:13:28 -0500 (CDT)
Attached is a patch which modifies the send-cluepacket.pl convenience
script so that it can send a cluepacket with multiple clues.
--
name: Jamin Philip Gray
email: jamin pubcrawler org
icq: 1361499
aim: jamingray47
yahoo: jamin47
web: http://pubcrawler.org
I don't want to achieve immortality through my work. I want to achieve
immortality through not dying.
-- Woody Allen
Index: send-cluepacket.pl
===================================================================
RCS file: /cvs/gnome/dashboard/frontends/send-cluepacket.pl,v
retrieving revision 1.1
diff -u -r1.1 send-cluepacket.pl
--- send-cluepacket.pl 25 Jul 2003 05:33:32 -0000 1.1
+++ send-cluepacket.pl 28 Jul 2003 15:11:05 -0000
@@ -1,41 +1,65 @@
-#!/usr/bin/perl -l
-#
-# A command-line script to send cluepackets to the Dashboard.
-#
-# Author:
-# Jamin Philip Gray <jamin pubcrawler org>
+#!/usr/bin/perl -lw
+
+# Authors: Jamin P. Gray <jamin pubcrawler org>
+# Purpose: Convenience script to send a cluepacket to Dashboard from
+# the command line
use Getopt::Long;
use Dashboard;
Getopt::Long::Configure("bundling");
-GetOptions("frontend|f=s", "context|c=s", "focused|F", "relevance|r=i", "help|?");
+my @clues = ();
+GetOptions("frontend|f=s" => \$frontend,
+ "context|x=s" => \$context,
+ "focused|F" => \$focused,
+ "clue|c=s" => \ clues,
+ "help|?" => \$help);
+
+&print_usage if (defined($help));
+
+$frontend = "send-cluepacket.pl" unless defined $frontend;
+$context = "send-cluepacket.pl" unless defined $context;
+$focused = 0 unless defined $focused;
+my @Clues;
+
+for (@clues) {
+ my ($type, $relevance, $text);
+ if (/(\w+) (\w+) (.+)/) {
+ $type = $1;
+ $relevance = $2;
+ $text = $3;
+ } else {
+ &print_usage;
+ }
+ push @Clues,
+ {
+ 'data' => $text,
+ 'type' => $type,
+ 'relevance' => $relevance
+ };
+}
+my $dash = new Dashboard($frontend);
+$dash->send_cluepacket($context, $focused, \ Clues);
-if (defined($opt_help)) {
+sub print_usage {
print qq{
-Usage: send-cluepacket.pl [OPTIONS] clue
+Usage: send-cluepacket.pl [OPTIONS]
Sends a cluepacket to Dashboard
- -f, --frontend=s name of the frontend
- -c, --context=s name of the context
- -F, --focused frontend is focused
- -r, --relevance=i relevance (1-10)
+ -f, --frontend=WORD frontend is WORD
+ -x, --context=WORD context is WORD
+ -F, --focused frontend is focused
+ -c, --clue="TYPE RELEVANCE TEXT" can be repeated for a cluepacket with multiple
+ clues. TYPE is cluetype. RELEVANCE is an
+ integer 1-10.
+
--help display this help and exit
+
+Example:
+send-cluepacket.pl --frontend myfrontend --context mycontext -F --clue "textblock 10 testing script" --clue "textblock 9 test2"
};
-exit(0);
+exit 0;
}
-my $frontend = $opt_frontend or "send-cluepacket.pl";
-my $context = $opt_context or "send-cluepacket.pl";
-my $focused = $opt_focused or 0;
-my $relevance = $opt_relevance or 10;
-
-my $dash = new Dashboard($frontend);
-$dash->send_cluepacket($context, $focused,
- [{
- 'data' => <>,
- 'type' => 'textblock',
- 'relevance' => $relevance
- }]);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]