dircat 0.0.5 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. data/LICENSE +1 -1
  2. data/README.rdoc +1 -1
  3. data/Rakefile +9 -0
  4. data/VERSION.yml +5 -0
  5. data/bin/dircat-build +6 -0
  6. data/bin/dircat-diff +6 -0
  7. data/bin/dircat-query +6 -0
  8. data/dircat.gemspec +88 -0
  9. data/examples/example.rb +10 -0
  10. data/lib/dircat/cat.rb +192 -0
  11. data/lib/dircat/cli/dircat_build.rb +92 -83
  12. data/lib/dircat/cli/dircat_diff.rb +85 -0
  13. data/lib/dircat/cli/dircat_query.rb +53 -43
  14. data/lib/dircat/entry.rb +60 -0
  15. data/lib/dircat/extension_md5.rb +24 -0
  16. data/lib/dircat/extension_numeric.rb +17 -0
  17. data/lib/dircat/report.rb +61 -0
  18. data/lib/dircat.rb +29 -2
  19. data/spec/dircat/cat_spec.rb +71 -0
  20. data/spec/dircat/cli/dircat_build_spec.rb +59 -0
  21. data/spec/dircat/cli/dircat_query_diff_spec.rb +26 -0
  22. data/spec/dircat/cli/dircat_query_spec.rb +35 -0
  23. data/spec/dircat/md5_spec.rb +12 -0
  24. data/spec/dircat/numeric_spec.rb +11 -0
  25. data/spec/spec_helper.rb +25 -0
  26. metadata +136 -40
  27. data/bin/dircat-build.rb +0 -8
  28. data/bin/dircat-cfr.rb +0 -8
  29. data/bin/dircat-cmp.rb +0 -8
  30. data/bin/dircat-query.rb +0 -8
  31. data/lib/dircat/cli/dircat_cfr.rb +0 -69
  32. data/lib/dircat/cli/dircat_cmp.rb +0 -65
  33. data/lib/dircat/dircat.rb +0 -263
  34. data/test/dircat/tc_dircat.rb +0 -83
  35. data/test/dircat/tc_dircat_build.rb +0 -43
  36. data/test/test_dircat.rb +0 -6
  37. /data/{test_data/dircat/data → spec/fixtures}/certified_output/dircat1.yaml +0 -0
  38. /data/{test_data/dircat/data → spec/fixtures}/certified_output/dircat2.yaml +0 -0
  39. /data/{test_data/dircat/data → spec/fixtures}/dir1/file1.txt +0 -0
  40. /data/{test_data/dircat/data → spec/fixtures}/dir1/subdir/file3.txt +0 -0
  41. /data/{test_data/dircat/data → spec/fixtures}/dir2/file1.txt +0 -0
  42. /data/{test_data/dircat/data → spec/fixtures}/dir2/file2.txt +0 -0
  43. /data/{test_data/dircat/data → spec/fixtures}/dir2/subdir/file3.txt +0 -0
  44. /data/{test_data/dircat/data → spec/fixtures}/dir3/file1.txt +0 -0
  45. /data/{test_data/dircat/data → spec/fixtures}/dir3/subdir/file1.txt +0 -0
  46. /data/{test_data/dircat/data → spec/fixtures}/tmp/dummy.txt +0 -0
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2009 gf
1
+ Copyright (c) 2009-2010 tokiro
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.rdoc CHANGED
@@ -33,4 +33,4 @@ sudo gem install gf-dircat -s gems.github.com
33
33
 
34
34
  == Copyright
35
35
 
36
- Copyright (c) 2009 gf. See LICENSE for details.
36
+ Copyright (c) 2009-2010 tokiro. See LICENSE for details.
data/Rakefile ADDED
@@ -0,0 +1,9 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ # Load tasks
5
+ Dir.glob('tasks/**/*.rake').each { |r| Rake.application.add_import r }
6
+
7
+ task :test => :check_dependencies
8
+ task :default => :spec
9
+
data/VERSION.yml ADDED
@@ -0,0 +1,5 @@
1
+ ---
2
+ :major: 0
3
+ :minor: 1
4
+ :patch: 4
5
+ :build:
data/bin/dircat-build ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ $:.unshift File.join( File.dirname( __FILE__), "..", "lib" )
3
+
4
+ require 'dircat'
5
+ include DirCat
6
+ exit DirCatBuild.run
data/bin/dircat-diff ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ $:.unshift File.join( File.dirname( __FILE__), "..", "lib" )
3
+
4
+ require 'dircat'
5
+ include DirCat
6
+ exit DirCatDiff.run
data/bin/dircat-query ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ $:.unshift(File.join( File.dirname( __FILE__), "..", "lib" ))
3
+
4
+ require 'dircat'
5
+ include DirCat
6
+ exit DirCatQuery.run
data/dircat.gemspec ADDED
@@ -0,0 +1,88 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{dircat}
8
+ s.version = "0.1.4"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Tokiro"]
12
+ s.date = %q{2010-12-17}
13
+ s.description = %q{
14
+ command line utilites to manage catalogs of directory
15
+ }
16
+ s.email = %q{tokiro.oyama@gmail.com}
17
+ s.executables = ["dircat-build", "dircat-diff", "dircat-query"]
18
+ s.extra_rdoc_files = [
19
+ "LICENSE",
20
+ "README.rdoc"
21
+ ]
22
+ s.files = [
23
+ "LICENSE",
24
+ "README.rdoc",
25
+ "Rakefile",
26
+ "VERSION.yml",
27
+ "dircat.gemspec",
28
+ "examples/example.rb",
29
+ "lib/dircat.rb",
30
+ "lib/dircat/cat.rb",
31
+ "lib/dircat/cli/dircat_build.rb",
32
+ "lib/dircat/cli/dircat_diff.rb",
33
+ "lib/dircat/cli/dircat_query.rb",
34
+ "lib/dircat/entry.rb",
35
+ "lib/dircat/extension_md5.rb",
36
+ "lib/dircat/extension_numeric.rb",
37
+ "lib/dircat/report.rb"
38
+ ]
39
+ s.homepage = %q{http://github.com/tokiro/dircat}
40
+ s.require_paths = ["lib"]
41
+ s.rubygems_version = %q{1.3.7}
42
+ s.summary = %q{command line utilites to manage catalogs of directory}
43
+ s.test_files = [
44
+ "spec/dircat/cat_spec.rb",
45
+ "spec/dircat/cli/dircat_build_spec.rb",
46
+ "spec/dircat/cli/dircat_query_diff_spec.rb",
47
+ "spec/dircat/cli/dircat_query_spec.rb",
48
+ "spec/dircat/md5_spec.rb",
49
+ "spec/dircat/numeric_spec.rb",
50
+ "spec/fixtures/certified_output/dircat1.yaml",
51
+ "spec/fixtures/certified_output/dircat2.yaml",
52
+ "spec/fixtures/dir1/file1.txt",
53
+ "spec/fixtures/dir1/subdir/file3.txt",
54
+ "spec/fixtures/dir2/file1.txt",
55
+ "spec/fixtures/dir2/file2.txt",
56
+ "spec/fixtures/dir2/subdir/file3.txt",
57
+ "spec/fixtures/dir3/file1.txt",
58
+ "spec/fixtures/dir3/subdir/file1.txt",
59
+ "spec/fixtures/tmp/dummy.txt",
60
+ "spec/spec_helper.rb"
61
+ ]
62
+
63
+ if s.respond_to? :specification_version then
64
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
65
+ s.specification_version = 3
66
+
67
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
68
+ s.add_development_dependency(%q<jeweler>, [">= 0"])
69
+ s.add_development_dependency(%q<rake>, [">= 0"])
70
+ s.add_development_dependency(%q<yard>, [">= 0"])
71
+ s.add_development_dependency(%q<bundler>, [">= 0"])
72
+ s.add_development_dependency(%q<rspec>, [">= 0"])
73
+ else
74
+ s.add_dependency(%q<jeweler>, [">= 0"])
75
+ s.add_dependency(%q<rake>, [">= 0"])
76
+ s.add_dependency(%q<yard>, [">= 0"])
77
+ s.add_dependency(%q<bundler>, [">= 0"])
78
+ s.add_dependency(%q<rspec>, [">= 0"])
79
+ end
80
+ else
81
+ s.add_dependency(%q<jeweler>, [">= 0"])
82
+ s.add_dependency(%q<rake>, [">= 0"])
83
+ s.add_dependency(%q<yard>, [">= 0"])
84
+ s.add_dependency(%q<bundler>, [">= 0"])
85
+ s.add_dependency(%q<rspec>, [">= 0"])
86
+ end
87
+ end
88
+
@@ -0,0 +1,10 @@
1
+ $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+
3
+ require 'dircat'
4
+ include DirCat
5
+
6
+ dir = File.join( File.dirname(__FILE__), "..")
7
+
8
+ cat = Cat.from_dir( dir )
9
+ cat.fmt_report
10
+
data/lib/dircat/cat.rb ADDED
@@ -0,0 +1,192 @@
1
+ module DirCat
2
+
3
+ class Cat
4
+
5
+ attr_reader :dirname
6
+
7
+ # data di creazione
8
+ attr_reader :ctime
9
+ attr_writer :ctime
10
+
11
+ def initialize( options = {} )
12
+ @verbose_level = options.delete(:verbose) || 0
13
+ @dirname = ""
14
+ @ctime = DateTime.now
15
+ @entries = Array.new
16
+ @md5ToEntries = Hash.new
17
+ end
18
+
19
+ def from_dir( dirname )
20
+ if not File.directory?( dirname )
21
+ raise "'#{dirname}' is not a directory or doesn't exists"
22
+ end
23
+ @dirname = File.expand_path dirname
24
+ @ctime = DateTime.now
25
+ _loadfromdir
26
+ self
27
+ end
28
+
29
+ def self.from_dir( dirname, options = {} )
30
+ new(options).from_dir(dirname)
31
+ end
32
+
33
+ def from_file( filename )
34
+ if not File.exist?( filename )
35
+ raise DirCatException.new, "'#{filename}' not exists"
36
+ end
37
+ dircat_ser = YAML::load( File.open( filename ) )
38
+ @dirname = dircat_ser.dirname
39
+ @ctime = dircat_ser.ctime
40
+ dircat_ser.entries.each{ |entry_ser|
41
+ add_entry( Entry.new.from_ser( entry_ser ) )
42
+ }
43
+ self
44
+ end
45
+
46
+ def self.from_file( filename, options = {} )
47
+ new(options).from_file(filename)
48
+ end
49
+
50
+ def to_ser
51
+ dircat_ser = DirCatSer.new
52
+ dircat_ser.version = 0.1
53
+ dircat_ser.dirname = @dirname
54
+ dircat_ser.ctime = @ctime
55
+ dircat_ser.entries = []
56
+ @entries.each { |entry|
57
+ dircat_ser.entries << entry.to_ser
58
+ }
59
+ dircat_ser
60
+ end
61
+
62
+ def _loadfromdir()
63
+ old_dirname = Dir.pwd
64
+ Dir.chdir( @dirname )
65
+ Dir["**/*"].each { |f|
66
+ next if File.directory?( f )
67
+
68
+ if @verbose_level > 0
69
+ cr = "\r"
70
+ clear = "\e[K"
71
+ print "#{cr}#{filename}#{clear}"
72
+ end
73
+
74
+ add_entry( Entry.new.from_filename( f ) )
75
+ }
76
+ if @verbose_level > 0
77
+ print "\n"
78
+ end
79
+ Dir.chdir( old_dirname )
80
+ self
81
+ end
82
+
83
+ def save_to( file )
84
+ if file.kind_of?(String)
85
+ begin
86
+ File.open( file, "w" ) do |f|
87
+ f.puts to_ser.to_yaml
88
+ end
89
+ rescue Errno::ENOENT
90
+ raise DirCatException.new, "DirCat: cannot write into '#{file}'", caller
91
+ end
92
+ else
93
+ file.puts to_ser.to_yaml
94
+ end
95
+ end
96
+
97
+ def size
98
+ @entries.size
99
+ end
100
+
101
+ def bytes
102
+ @entries.inject(0) {|sum, entry| sum + entry.size }
103
+ end
104
+
105
+ def report
106
+ dups = duplicates
107
+ s = "Base dir: #@dirname\n" +
108
+ "Nr. file: #{size}\n" +
109
+ "Bytes: #{bytes.with_separator}"
110
+ if duplicates.size > 0
111
+ s+= "\n duplicates #{dups.size}"
112
+ end
113
+ s
114
+ end
115
+
116
+ def add_entry( e )
117
+ @entries.push( e )
118
+ if @md5ToEntries.has_key?( e.md5 )
119
+ # puts "Entry duplicata!!!"
120
+ @md5ToEntries[ e.md5 ].push( e )
121
+ else
122
+ @md5ToEntries[ e.md5 ] = [ e ]
123
+ end
124
+ end
125
+
126
+ def contains( e )
127
+ @md5ToEntries.has_key?( e.md5 )
128
+ end
129
+
130
+ def -(s)
131
+ result = Cat.new
132
+ @entries.each { |e|
133
+ result.add_entry(e) unless s.contains(e)
134
+ }
135
+ result
136
+ end
137
+
138
+ def duplicates
139
+ list = []
140
+ @md5ToEntries.each_value do |ee|
141
+ next if ee.size < 2
142
+ list.push( ee )
143
+ end
144
+ list
145
+ end
146
+
147
+ def fmt_simple
148
+ @entries.each { |e|
149
+ print e.to_s
150
+ }
151
+ end
152
+
153
+ def fmt_report
154
+ DirCat::report(@entries, :md5, :name, :path)
155
+ end
156
+
157
+ def fmt_ruby( dst )
158
+ puts "require 'fileutils'"
159
+ @entries.each { |entry|
160
+ src = File.join( @dirname, entry.path, entry.name );
161
+ puts "FileUtils.cp( \"#{src}\", \"#{dst}\" )"
162
+ }
163
+ end
164
+
165
+ def list_dup
166
+ r = ""
167
+ duplicates.flatten.each { |e|
168
+ r += e.to_s + "\n"
169
+ }
170
+ r
171
+ end
172
+
173
+ def script_dup
174
+ r = "require 'fileutils'\n"
175
+ duplicates.each { |entries|
176
+ flg_first = true
177
+ r += "\n"
178
+ entries.each{ |entry|
179
+ src = File.join( @dirname, entry.path, entry.name );
180
+ if flg_first
181
+ flg_first = false
182
+ r += "# FileUtils.mv( \"#{src}\", \"#{Dir.tmpdir}\" )\n"
183
+ else
184
+ r += "FileUtils.mv( \"#{src}\", \"#{Dir.tmpdir}\" )\n"
185
+ end
186
+ }
187
+ }
188
+ r
189
+ end
190
+
191
+ end
192
+ end
@@ -1,105 +1,114 @@
1
- # stdlib
2
- require 'optparse'
1
+ module DirCat
2
+ #
3
+ # Build a catalogue starting from a directory
4
+ #
5
+ class DirCatBuild
6
+
7
+ def self.run
8
+ return self.new.parse_args( ARGV )
9
+ end
3
10
 
4
- # dircat
5
- require 'dircat/dircat.rb'
11
+ def parse_args( argv )
12
+ options = { :verbose => true, :force => false }
13
+ opts = OptionParser.new
14
+ opts.banner << "Usage: dircat-build [options]\n"
15
+ opts.banner << "\n"
16
+ opts.banner << "Build a catalogue starting from a directory\n";
17
+ opts.banner << "\n"
18
+
19
+ opts.on("-h", "--help", "Print this message") do
20
+ puts opts
21
+ return 0
22
+ end
6
23
 
7
- #
8
- # Build a catalogue starting from a directory
9
- #
10
- class DirCatBuild
24
+ opts.on("--version", "show the dircat version") do
25
+ puts "dircat version #{DirCat::version}"
26
+ return 0
27
+ end
11
28
 
12
- def self.run
13
- self.new.parse_args( ARGV )
14
- end
29
+ opts.on("-v", "--[no-]verbose", "Run verbosely") do |v|
30
+ options[:verbose] = v
31
+ end
15
32
 
16
- def parse_args( argv )
17
- options = { :verbose => true, :force => false }
18
- opts = OptionParser.new
19
- opts.banner << "Usage: dircat_build [options]\n"
20
- opts.banner << "\n"
21
- opts.banner << "Build a catalogue starting from a directory\n";
22
- opts.banner << "\n"
23
-
24
- opts.on("-h", "--help", "Print this message") do
25
- puts opts
26
- return
27
- end
33
+ opts.on("-q", "--quiet", "quiet mode as --no-verbose") do |v|
34
+ options[:verbose] = false
35
+ end
28
36
 
29
- opts.on("-v", "--[no-]verbose", "Run verbosely") do |v|
30
- options[:verbose] = v
31
- end
37
+ opts.on("-f", "--force", "force write on existent file") do |v|
38
+ options[:force] = true
39
+ end
32
40
 
33
- opts.on("-q", "--quiet", "quiet mode as --no-verbose") do |v|
34
- options[:verbose] = false
35
- end
41
+ opts.on("-o [FILE]", "--output [FILE]",String) do |v|
42
+ if options[:output]
43
+ puts "only one file of output can be used"
44
+ return 1
45
+ end
46
+ options[:output] = v
47
+ end
36
48
 
37
- opts.on("-f", "--force", "force write on existent file") do |v|
38
- options[:force] = true
39
- end
49
+ rest = opts.parse(argv)
40
50
 
41
- opts.on("-o [FILE]", "--output [FILE]",String) do |v|
42
- options[:output] = v
43
- end
51
+ # p options
52
+ # p ARGV
44
53
 
45
- rest = opts.parse(argv)
46
-
47
- # p options
48
- # p ARGV
54
+ if rest.length < 1
55
+ puts "directory (from which build catalog) is missing"
56
+ puts "-h to print help"
57
+ return 0
58
+ end
49
59
 
50
- if rest.length < 1
51
- puts "inserire il nome della directory di cui creare il catalogo"
52
- puts "-h to print help"
53
- return
54
- end
60
+ dirname = rest[0]
61
+ dirname = File.expand_path( dirname )
62
+ cat_opts = {}
55
63
 
56
- dirname = rest[0]
57
- dirname = File.expand_path( dirname )
58
- if not FileTest.directory?(dirname)
59
- puts "directory "#{dirname} not exists or is not a directory"
60
- return
61
- end
64
+ if not FileTest.directory?(dirname)
65
+ puts "'#{dirname}' not exists or is not a directory"
66
+ return 0
67
+ end
62
68
 
63
- #
64
- # option verbose
65
- #
69
+ #
70
+ # option verbose
71
+ #
66
72
 
67
- if options.has_key?(:verbose)
68
- if options[:verbose]
69
- $VERBOSE_LEVEL = 1
73
+ if options.has_key?(:verbose)
74
+ if options[:verbose]
75
+ cat_opts[:verbose_level] = 1
76
+ end
70
77
  end
71
- end
72
78
 
73
- #
74
- # option: output, force
75
- #
76
- output = $stdout
77
- if options.has_key?(:output)
78
- if options[:output]
79
- filename = options[:output]
80
- else
81
- filename = "cat_" + File.basename( dirname ) + "_" + Date.today.strftime("%Y%m%d") + ".yaml"
79
+ #
80
+ # option: output, force
81
+ #
82
+ output = $stdout
83
+ if options.has_key?(:output)
84
+ if options[:output]
85
+ filename = options[:output]
86
+ else
87
+ filename = "cat_" + File.basename( dirname ) + "_" + Date.today.strftime("%Y%m%d") + ".yaml"
88
+ end
89
+ if File.exist?(filename) and not options[:force]
90
+ puts "catalog '#{filename}' exists use --force or -f to overwrite"
91
+ return 0
92
+ end
93
+ output = File.open(filename, "w")
82
94
  end
83
- if File.exist?(filename) and not options[:force]
84
- puts "File #{filename} exists use --force or -f to overwrite"
85
- return
86
- end
87
- output = File.open(filename, "w")
88
- end
89
95
 
90
- start_datetime = DateTime.now
91
- s = DirCat.loadfromdir(dirname)
92
- end_datetime = DateTime.now
96
+ start_time = Time.now
97
+ s = Cat.from_dir(dirname)
98
+ end_time = Time.now
99
+
100
+ # s.pr
101
+ # f.puts s.to_yaml
102
+ s.save_to( output )
93
103
 
94
- # s.pr
95
- # f.puts s.to_yaml
96
- s.savetofile( output )
104
+ if output != $stdout
105
+ output.close
106
+ end
107
+ $stderr.puts s.report
108
+ $stderr.puts "elapsed: #{end_time - start_time}"
97
109
 
98
- if output != $stdout
99
- output.close
110
+ 0
100
111
  end
101
- $stderr.puts s.report
102
- $stderr.puts "tempo: #{end_datetime - start_datetime}"
103
- end
104
112
 
113
+ end
105
114
  end
@@ -0,0 +1,85 @@
1
+ module DirCat
2
+
3
+ class DirCatDiff
4
+
5
+ def self.run
6
+ return self.new.parse_args( ARGV )
7
+ end
8
+
9
+ def parse_args( args )
10
+ options = {}
11
+ opts = OptionParser.new
12
+ opts.banner =
13
+ "Usage: dircat_cfr.rb [options] <filedircat1> <filedircat2>\n\n" +
14
+ "fa la differenza fra il primo catalog e il secondo\n" +
15
+ "<filedircat1> - <filedircat2>\n" +
16
+ "e stampa sull'output con un formato\n"
17
+
18
+ opts.on("-h", "--help", "Print this message") do
19
+ puts opts
20
+ return 0
21
+ end
22
+
23
+ opts.on("--version", "show the dircat version") do
24
+ puts "dircat version #{DirCat::version}"
25
+ return 0
26
+ end
27
+
28
+ opts.on("-v", "--[no-]verbose", "Run verbosely") do |v|
29
+ options[:verbose] = v
30
+ end
31
+
32
+ opts.on("-f FORMAT", "--fmt FORMAT", "formato") do |v|
33
+ options[:fmt] = v
34
+ end
35
+ rest = opts.parse( args )
36
+
37
+ # p options
38
+ # p ARGV
39
+
40
+ if rest.length < 2
41
+ puts "you must provide two args (catalogs or directory)"
42
+ puts "dircat_cfr -h to print help"
43
+ exit
44
+ end
45
+
46
+ cat_filename1 = rest[0]
47
+ cat_filename2 = rest[1]
48
+
49
+ if File.exists?( cat_filename1 )
50
+ puts "load catalog #{cat_filename1}"
51
+ s1 = Cat.from_file(cat_filename1)
52
+ elsif File.directory?(cat_filename1)
53
+ puts "build first set from directory #{cat_filename1}"
54
+ s1 = Cat.from_dir(cat_filename1)
55
+ else
56
+ puts "#{cat_filename1} is not a catalog file or directory"
57
+ return 1
58
+ end
59
+
60
+ if File.exists?( cat_filename2 )
61
+ puts "load catalog #{cat_filename2}"
62
+ s2 = Cat.from_file(cat_filename2)
63
+ elsif File.directory?(cat_filename2)
64
+ puts "build first set from directory #{cat_filename2}"
65
+ s2 = Cat.from_dir(cat_filename2)
66
+ else
67
+ puts "#{cat_filename2} is not a catalog file or directory"
68
+ return 1
69
+ end
70
+
71
+ puts "build difference"
72
+ s3 = s1 - s2
73
+
74
+ case options[:fmt]
75
+ when "simple"
76
+ s3.fmt_simple
77
+ when "ruby"
78
+ s3.fmt_ruby( "." )
79
+ else
80
+ s3.fmt_simple
81
+ end
82
+ 0
83
+ end
84
+ end
85
+ end