Sha256: 690af687930e3d1973ac8b19794c1ba863d1c3e1398a0a67beeb29953ff6cd62
Contents?: true
Size: 877 Bytes
Versions: 1
Compression:
Stored size: 877 Bytes
Contents
# frozen_string_literal: true class Shoes module UI class CLI class BaseCommand attr_reader :args def initialize(*args) @args = args end def warn_on_unexpected_parameters(expected_size = 1) return unless args.size > expected_size unexpected = args[expected_size..-1].join(" ") Shoes.logger.warn("Unexpected extra parameters '#{unexpected}'") end def parse!(args) options.parse!(args) true rescue OptionParser::InvalidOption => e puts "Whoops! #{e.message}" puts puts help false end def help nil end def help_from_options(command, options) lines = ["#{command}\n"] + options.summarize lines.join("") end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
shoes-core-4.0.0.rc1 | lib/shoes/ui/cli/base_command.rb |