class Totes::Cli
Public Class Methods
new(args)
click to toggle source
# File lib/totes/cli.rb, line 3 def initialize(args) sources = parse_args(args) require_relative "./autorun" Totes::Resolver.new(sources).require_all end
Private Instance Methods
parse_args(args)
click to toggle source
# File lib/totes/cli.rb, line 12 def parse_args(args) [].tap do |sources| while arg = args.shift case arg when '-h', '--help' then print_help else sources << arg end end end end
print_help()
click to toggle source
# File lib/totes/cli.rb, line 23 def print_help print_nicely_and_exit %Q{ Totally awesome tests usage: totes [path ...] [OPTIONS] OPTIONS: -h, --help # show this help } end
print_nicely_and_exit(string)
click to toggle source
# File lib/totes/cli.rb, line 34 def print_nicely_and_exit(string) print string.gsub(string[/\A(\n +)/], "\n").strip + "\n\n" exit end