sup

A curses threads-with-tags style email client

sup.git

git clone https://supmua.dev/git/sup/
commit a31bc5645aac2afcaca3a94b273fd76832fb9509
parent a680c951128deb99de2f7a5e32a5aeda35f25dc6
Author: Wael M. Nasreddine <wael.nasreddine@gmail.com>
Date:   Thu,  1 May 2014 09:19:17 +0200

Merge #300: sup-tweak-labels sync back unless specified otherwise

Squashed commit of the following:

commit ebfb3335070bba8e27551dcc4c232a4de2e98044
Author: Wael M. Nasreddine 
Date:   Wed Apr 30 22:26:10 2014 -0700

    sup-tweak-labels: add a newline before the begin

commit f1d51d3961b0864c5f05f7b728cf5dd722a967eb
Author: Wael M. Nasreddine 
Date:   Wed Apr 30 22:22:23 2014 -0700

    sup-tweak-labels: sync_back (honor the settings global and source) and provide an override

commit c43319a5fdfb725455beda51b7ec08799ecdda89
Author: Wael M. Nasreddine 
Date:   Tue Apr 29 15:54:01 2014 -0700

    sup-tweak-labels: sync back if specified

Diffstat:
M History.txt | 1 +
M ReleaseNotes | 4 ++++
M bin/sup-tweak-labels | 7 ++++++-
3 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/History.txt b/History.txt
@@ -2,6 +2,7 @@
 
 * new color option, :with_attachment for defining colors for the
   attachment character.
+* sup-tweak-labels works again (out of service since sync_back).
 
 == 0.17.0 / 2014-04-11
 
diff --git a/ReleaseNotes b/ReleaseNotes
@@ -1,3 +1,7 @@
+Release ......:
+
+sup-tweak-labels works again.
+
 Release 0.17.0:
 
 Bugfixes and new option for continous scrolling as well as an option for
diff --git a/bin/sup-tweak-labels b/bin/sup-tweak-labels
@@ -51,6 +51,7 @@ EOS
   opt :very_verbose, "Print message names and subjects as they're processed."
   opt :all_sources, "Scan over all sources.", :short => :none
   opt :dry_run, "Don't actually modify the index. Probably only useful with --verbose.", :short => "-n"
+  opt :no_sync_back, "Do not sync back to the original Maildir."
   opt :version, "Show version information", :short => :none
 end
 opts[:verbose] = true if opts[:very_verbose]
@@ -63,6 +64,7 @@ Trollop::die "nothing to do: no labels to add or remove" if add_labels.empty? &&
 Redwood::start
 index = Redwood::Index.init
 index.lock_interactively or exit
+
 begin
   index.load
 
@@ -106,7 +108,10 @@ begin
       puts "From #{m.from}, subject: #{m.subj}" if opts[:very_verbose]
       puts "#{m.id}: {#{old_labels.to_a.join ','}} => {#{m.labels.to_a.join ','}}" if opts[:verbose]
       puts if opts[:very_verbose]
-      index.update_message_state m unless opts[:dry_run]
+      unless opts[:dry_run]
+        index.update_message_state [m, false]
+        m.sync_back unless opts[:no_sync_back]
+      end
     end
 
     if Time.now - last_info_time > 60