Sha256: b6e5e7723112e071adef610e8328f68f17438e298cdfc9b38adc0f0f2a5ec9e5
Contents?: true
Size: 928 Bytes
Versions: 2
Compression:
Stored size: 928 Bytes
Contents
require "conference_tracker/scheduler" module ConferenceTracker class CLI HELP_FLAGS = %w[-h --help] COL_WIDTH = 23 def initialize(input, pipe = STDOUT, scheduler = Scheduler) @input = input @pipe = pipe @scheduler = scheduler end def call @pipe.puts output end private def output return help if help? return unless file? talks = File.readlines(@input).map(&:strip) @scheduler.new(talks).call end private def file? File.file?(File.expand_path(@input)) end private def help? HELP_FLAGS.include?(@input) end private def help [].tap do |h| h << %q{Usage: conference_tracker ~/talks.txt} h << " %-#{COL_WIDTH}s Print this help" % "-h --help" h << " %-#{COL_WIDTH}s Load conference talks" % "<path-to-file>" end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
conference_tracker-1.1.1 | lib/conference_tracker/cli.rb |
conference_tracker-1.1.0 | lib/conference_tracker/cli.rb |