Sha256: 3fc1343d3a1d98be4fa2e72666c64497c54be838752fdfc0253f8bfac6dfdedb

Contents?: true

Size: 871 Bytes

Versions: 2

Compression:

Stored size: 871 Bytes

Contents

require File.expand_path('actions/base', __dir__)
require File.expand_path('actions/init', __dir__)
require File.expand_path('actions/compose', __dir__)
require File.expand_path('actions/help', __dir__)

module Sshster
  class App
    attr_accessor :options

    def initialize(options)
      @options = options
    end

    def run
      case command
      when :init then action_init
      when :compose then action_compose
      when :help then action_help
      else action_help
      end
    end

    def action_init
      Actions::Init.new(config).run
    end

    def action_compose
      action_init
      Actions::Compose.new(config).run
    end

    def action_help
      Actions::Help.new.run
    end

    private

    def config
      @config ||= Config.new(options.config).merge
    end

    def command
      @command ||= @options.command
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sshster-0.1.1 lib/sshster/app.rb
sshster-0.1.0 lib/sshster/app.rb