From: rlane@club.cc.cmu.edu (Rich Lane)
Subject: [sup-talk] [PATCH 2/5] console: add/remove labels
Date: Sun, 16 Aug 2009 23:39:12 -0700 [thread overview]
Message-ID: <1250491155-19281-2-git-send-email-rlane@club.cc.cmu.edu> (raw)
In-Reply-To: <1250491155-19281-1-git-send-email-rlane@club.cc.cmu.edu>
---
lib/sup/modes/console-mode.rb | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/lib/sup/modes/console-mode.rb b/lib/sup/modes/console-mode.rb
index d06d37b..a91bbbf 100644
--- a/lib/sup/modes/console-mode.rb
+++ b/lib/sup/modes/console-mode.rb
@@ -6,6 +6,18 @@ class Console
def initialize mode
@mode = mode
end
+
+ def query(query)
+ Enumerable::Enumerator.new(Index, :each_message, Index.parse_query(query))
+ end
+
+ def add_labels(query, *labels)
+ query(query).each { |m| m.labels += labels; m.save Index }
+ end
+
+ def remove_labels(query, *labels)
+ query(query).each { |m| m.labels -= labels; m.save Index }
+ end
end
class ConsoleMode < LogMode
--
1.6.4
next prev parent reply other threads:[~2009-08-17 6:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-17 6:39 [sup-talk] [PATCH 1/5] console mode Rich Lane
2009-08-17 6:39 ` Rich Lane [this message]
2009-08-17 6:39 ` [sup-talk] [PATCH 3/5] console: index internals accessor Rich Lane
2009-08-17 6:39 ` [sup-talk] [PATCH 4/5] console: reload Rich Lane
2009-08-17 6:39 ` [sup-talk] [PATCH 5/5] console: clear_hooks Rich Lane
2009-08-18 18:37 ` [sup-talk] [PATCH 1/5] console mode William Morgan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1250491155-19281-2-git-send-email-rlane@club.cc.cmu.edu \
--to=rlane@club.cc.cmu.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox