]> git.notmuchmail.org Git - sup/commitdiff
allow specifying a noun for tagged items, instead of always using "thread"
authorWilliam Morgan <wmorgan-sup@masanjin.net>
Thu, 31 Jan 2008 06:16:54 +0000 (22:16 -0800)
committerWilliam Morgan <wmorgan-sup@masanjin.net>
Thu, 31 Jan 2008 06:16:54 +0000 (22:16 -0800)
The "Apply to ..." prompt is generated by the tagger. Sometimes you're not
tagging threads, though, you're tagging something else. (E.g. in
contact-list-mode.)

lib/sup/tagger.rb

index 3e72463fc0e90128c5dd39e4c3f3535d9bc2cd7f..d62f3404557d637af7c70631e780ad0c63b1df02 100644 (file)
@@ -1,9 +1,11 @@
 module Redwood
 
 class Tagger
-  def initialize mode
+  def initialize mode, noun="thread", plural_noun=nil
     @mode = mode
     @tagged = {}
+    @noun = noun
+    @plural_noun = plural_noun || (@noun + "s")
   end
 
   def tagged? o; @tagged[o]; end
@@ -21,7 +23,7 @@ class Tagger
       return
     end
 
-    noun = num_tagged == 1 ? "thread" : "threads"
+    noun = num_tagged == 1 ? @noun : @plural_noun
 
     unless action
       c = BufferManager.ask_getch "apply to #{num_tagged} tagged #{noun}:"