Sha256: 56eb0597e3533704701e8b0ab39d347bca18c6e7d2a61c4142e7f3375b3240f1

Contents?: true

Size: 463 Bytes

Versions: 2

Compression:

Stored size: 463 Bytes

Contents

# frozen_string_literal: true

require_relative 'options'

module Balboa
  module CLI
    class Application
      CommandNotFound = Class.new(RuntimeError)

      def initialize(command_id)
        @command_id = command_id.to_s
        @commands = Hash.new { fail CommandNotFound }
      end

      def add_command(key, command)
        @commands[key.to_s] = command
      end

      def execute
        @commands[@command_id].execute
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
balboa-0.1.1 lib/balboa/cli/application.rb
balboa-0.1.0 lib/balboa/cli/application.rb