Class: Fingerprint::Command::Top

Inherits:
Samovar::Command
  • Object
show all
Defined in:
lib/fingerprint/command.rb

Instance Method Summary collapse

Instance Method Details

#callObject



77
78
79
80
81
82
83
84
85
86
87
# File 'lib/fingerprint/command.rb', line 77

def call
	if @options[:version]
		puts "fingerprint v#{VERSION}"
	elsif @options[:help]
		self.print_usage(program_name)
	else
		chdir do
			@command.call
		end
	end
end

#chdir(&block) ⇒ Object



53
54
55
56
57
58
59
# File 'lib/fingerprint/command.rb', line 53

def chdir(&block)
	if root = @options[:root]
		Dir.chdir(root, &block)
	else
		yield
	end
end

#outputObject



61
62
63
64
65
66
67
# File 'lib/fingerprint/command.rb', line 61

def output
	if path = @options[:output]
		File.open(path, "w")
	else
		$stdout
	end
end