Sha256: 1d4cf4d0af9a7248ad13ed5c0d4fff14716dacbf633db2a28a02392adfb428da

Contents?: true

Size: 1.34 KB

Versions: 7

Compression:

Stored size: 1.34 KB

Contents

# frozen_string_literal: true

require 'hamster'

require_relative 'mixins/appliables'
require_relative 'mixins/arguments'
require_relative 'mixins/environment_variables'
require_relative 'mixins/executor'
require_relative 'mixins/option_config'
require_relative 'mixins/options'
require_relative 'mixins/state_boundary'
require_relative 'mixins/subcommands'
require_relative 'mixins/validation'
require_relative 'mixins/working_directory'
require_relative '../model'

module Lino
  module Builders
    class CommandLine
      include Mixins::StateBoundary
      include Mixins::Arguments
      include Mixins::EnvironmentVariables
      include Mixins::OptionConfig
      include Mixins::Options
      include Mixins::Subcommands
      include Mixins::Executor
      include Mixins::WorkingDirectory
      include Mixins::Appliables
      include Mixins::Validation

      def initialize(state)
        @command = state[:command]
        super
      end

      def build
        Model::CommandLine.new(
          @command,
          state.merge(
            options: build_options,
            subcommands: build_subcommands
          )
        )
      end

      protected

      def state
        super.merge(command: @command)
      end

      private

      def with(replacements)
        Builders::CommandLine.new(state.merge(replacements))
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
lino-4.0.0 lib/lino/builders/command_line.rb
lino-4.0.0.pre.2 lib/lino/builders/command_line.rb
lino-3.2.0.pre.10 lib/lino/builders/command_line.rb
lino-3.2.0.pre.9 lib/lino/builders/command_line.rb
lino-3.2.0.pre.8 lib/lino/builders/command_line.rb
lino-3.2.0.pre.7 lib/lino/builders/command_line.rb
lino-3.2.0.pre.6 lib/lino/builders/command_line.rb