Sha256: 975044626c67424d2f74fe2dc996bead23f754115afe3e0cfd9d2bfb484137cc

Contents?: true

Size: 953 Bytes

Versions: 6

Compression:

Stored size: 953 Bytes

Contents

#! /usr/bin/ruby

require 'optparse'
require 'rubygems'
require 'ole/storage'

def oletool
	opts = {:verbose => false, :action => :tree}
	op = OptionParser.new do |op|
		op.banner = "Usage: oletool [options] [files]"
		op.separator ''
		op.on('-t', '--tree', 'Dump ole trees for files (default)') { opts[:action] = :tree }
		op.on('-r', '--repack', 'Repack the ole files in canonical form') { opts[:action] = :repack }
		op.separator ''
		op.on('-v', '--[no-]verbose', 'Run verbosely') { |v| opts[:verbose] = v }
		op.on_tail('-h', '--help', 'Show this message') { puts op; exit }
	end
	files = op.parse ARGV
	if files.empty?
		puts 'Must specify 1 or more msg files.'
		puts op
		exit 1
	end
	Ole::Log.level = opts[:verbose] ? Logger::WARN : Logger::FATAL
	files.each do |file|
		case opts[:action]
		when :tree
			Ole::Storage.open(file) { |ole| puts ole.root.to_tree }
		when :repack
			Ole::Storage.open file, 'r+', &:repack
		end
	end
end

oletool

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ruby-ole-1.2.1 bin/oletool
ruby-ole-1.2.3 bin/oletool
ruby-ole-1.2.6 bin/oletool
ruby-ole-1.2.5 bin/oletool
ruby-ole-1.2.2 bin/oletool
ruby-ole-1.2.4 bin/oletool