class Stewfinder::Command
Provides the command line interface to Stewfinder
Constants
- DOC
Public Class Methods
new()
click to toggle source
# File lib/stewfinder/command.rb, line 23 def initialize @exit_status = 0 end
Public Instance Methods
run()
click to toggle source
# File lib/stewfinder/command.rb, line 27 def run options = Docopt.docopt(DOC, argv: argv, version: VERSION) finder = Finder.new(File.absolute_path(options['PATH'] || Dir.pwd)) finder.print_stewards(options['--sort']) @exit_status rescue Docopt::Exit => exc exit_with_status(exc.message, exc.class.usage != '') rescue StandardError => exc exit_with_status(exc.message) end
Private Instance Methods
argv()
click to toggle source
# File lib/stewfinder/command.rb, line 40 def argv ARGV end
exit_with_status(message, condition = true)
click to toggle source
# File lib/stewfinder/command.rb, line 44 def exit_with_status(message, condition = true) puts message @exit_status = condition ? 1 : @exit_status end