X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=bin%2Fsup-sync-back;h=4216cf9e46f5db3c595b72edb8462f15bb0fe966;hb=d496466daeef90657118c9c5a729d18296efa4b2;hp=ba2aa67db15731ad41fdcbe285bbe50dc1b0a5fb;hpb=fe20a6315dcc4053566a89b92fa01f14f40533d0;p=sup diff --git a/bin/sup-sync-back b/bin/sup-sync-back index ba2aa67..4216cf9 100644 --- a/bin/sup-sync-back +++ b/bin/sup-sync-back @@ -8,14 +8,17 @@ require "sup" ## save a message 'm' to an open file pointer 'fp' def save m, fp - m.source.each_raw_full_message_line(m.source_info) { |l| fp.print l } + m.source.each_raw_message_line(m.source_info) { |l| fp.print l } +end +def die msg + $stderr.puts "Error: #{msg}" + exit(-1) end opts = Trollop::options do version "sup-sync-back (sup #{Redwood::VERSION})" banner <* is zero or more source URIs. If no sources are given, sync back all usual sources. -You probably want to run sup-sync --changed after this command. +You almost certainly want to run sup-sync --changed after this command. +Running this does not change the index. Options include: EOS - opt :delete_deleted, "Delete deleted messages.", :default => false, :short => "d" + opt :drop_deleted, "Drop deleted messages.", :default => false, :short => "d" opt :move_deleted, "Move deleted messages to a local mbox file.", :type => String, :short => :none - opt :delete_spam, "Delete spam messages.", :default => false, :short => "s" + opt :drop_spam, "Drop spam messages.", :default => false, :short => "s" opt :move_spam, "Move spam messages to a local mbox file.", :type => String, :short => :none + + opt :with_dotlockfile, "Specific dotlockfile location (mbox files only).", :default => "/usr/bin/dotlockfile", :short => :none + opt :dont_use_dotlockfile, "Don't use dotlockfile to lock mbox files. Dangerous if other processes modify them concurrently.", :default => false, :short => :none + opt :verbose, "Print message ids as they're processed." opt :dry_run, "Don't actually modify the index. Probably only useful with --verbose.", :short => "-n" opt :version, "Show version information", :short => :none - conflicts :delete_deleted, :move_deleted - conflicts :delete_spam, :move_spam + conflicts :drop_deleted, :move_deleted + conflicts :drop_spam, :move_spam +end + +unless opts[:drop_deleted] || opts[:move_deleted] || opts[:drop_spam] || opts[:move_spam] + puts < e File.open("sup-exception-log.txt", "w") { |f| f.puts e.backtrace } raise ensure - index.save Redwood::finish index.unlock end