Sha256: 224e329dfdcdb5065e13cd9831a63d3078389c944898478f26fc7aa301edd80f
Contents?: true
Size: 550 Bytes
Versions: 5
Compression:
Stored size: 550 Bytes
Contents
module WB class CLI def initialize(commands) @commands = commands end def run(arguments: ARGV) command = find_command(arguments[0]) command.run(arguments[1]) end private attr_reader :commands def find_command(name) command = find_command_by_name(name) || default_command command.new end def find_command_by_name(name) commands.find { |command| command.name == name } end def default_command commands.find { |command| command.name == "" } end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
wb-1.1.0 | lib/wb/cli.rb |
wb-1.0.3 | lib/wb/cli.rb |
wb-1.0.2 | lib/wb/cli.rb |
wb-1.0.1 | lib/wb/cli.rb |
wb-1.0.0 | lib/wb/cli.rb |