]> git.cworth.org Git - sup/blob - bin/sup-dump
Merge branch 'console-mode' into next
[sup] / bin / sup-dump
1 #!/usr/bin/env ruby
2
3 require 'rubygems'
4 require 'trollop'
5 require "sup"
6
7 $opts = Trollop::options do
8   version "sup-dump (sup #{Redwood::VERSION})"
9   banner <<EOS
10 Dumps all message state from the sup index to standard out. You can
11 later use sup-sync --restored --restore <filename> to recover the index.
12
13 This tool is primarily useful in the event that a Ferret upgrade breaks
14 the index format. This happened, for example, at Ferret version 0.11.
15
16 Usage:
17   sup-dump > <filename>
18   sup-dump | bzip2 > <filename> # even better
19
20 No options.
21 EOS
22 end
23
24 index = Redwood::Index.init
25 Redwood::SourceManager.init
26 index.load
27
28 index.each_message :load_spam => true, :load_deleted => true, :load_killed => true do |m|
29   puts "#{m.id} (#{m.labels.to_a * ' '})"
30 end