Sha256: 73b49da4e4989eee740f0142dc3e48f69abbf81274ca26a650e3bdbe95c72421

Contents?: true

Size: 779 Bytes

Versions: 6

Compression:

Stored size: 779 Bytes

Contents

require "hanami/cli"
require "snowpack"
require_relative "commands"

module Snowpack
  module CLI
    module Application
      class CLI < Hanami::CLI
        attr_reader :application

        def initialize(application: Snowpack.application, commands: Commands)
          super(commands)
          @application = application
        end

        private

        # TODO: we should make a prepare_command method upstream
        def parse(result, out)
          command, arguments = super

          if command.respond_to?(:with_application)
            application.config.env = arguments[:env] if arguments[:env]
            [command.with_application(application), arguments]
          else
            [command, arguments]
          end
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
snowpack-1.0.0.alpha7 lib/snowpack/cli/application/cli.rb
snowpack-1.0.0.alpha6 lib/snowpack/cli/application/cli.rb
snowpack-1.0.0.alpha5 lib/snowpack/cli/application/cli.rb
snowpack-1.0.0.alpha4 lib/snowpack/cli/application/cli.rb
snowpack-1.0.0.alpha3 lib/snowpack/cli/application/cli.rb
snowpack-1.0.0.alpha2 lib/snowpack/cli/application/cli.rb