Sha256: 7f14cb44af88d0303a1653b584d316f754f4512235d19d3ba1093fdd2f174dd6

Contents?: true

Size: 826 Bytes

Versions: 40

Compression:

Stored size: 826 Bytes

Contents

# frozen_string_literal: true

require 'eac_cli/runner'
require 'eac_ruby_utils/core_ext'
require 'eac_ruby_utils/acts_as_abstract'

module EacCli
  module RunnerWith
    module Input
      STDIN_OPTION = '-'
      BLANK_OPTION = '+'
      DEFAULT_DEFAULT_INPUT_OPTION = BLANK_OPTION

      common_concern do
        enable_settings_provider
        include ::EacCli::Runner

        runner_definition do
          arg_opt '-i', '--input', 'Input from file.'
        end
      end

      def input_content
        case input_option
        when STDIN_OPTION then $stdin.read
        when BLANK_OPTION then ''
        else input_option.to_pathname.read
        end
      end

      def input_option
        parsed.input || setting_value(:default_input_option, default: DEFAULT_DEFAULT_INPUT_OPTION)
      end
    end
  end
end

Version data entries

40 entries across 40 versions & 2 rubygems

Version Path
eac_cli-0.42.0 lib/eac_cli/runner_with/input.rb
eac_cli-0.40.1 lib/eac_cli/runner_with/input.rb
eac_cli-0.40.0 lib/eac_cli/runner_with/input.rb
eac_cli-0.39.0 lib/eac_cli/runner_with/input.rb
eac_cli-0.38.1 lib/eac_cli/runner_with/input.rb
eac_tools-0.82.0 sub/eac_cli/lib/eac_cli/runner_with/input.rb
eac_tools-0.81.0 sub/eac_cli/lib/eac_cli/runner_with/input.rb
eac_tools-0.80.0 sub/eac_cli/lib/eac_cli/runner_with/input.rb
eac_tools-0.79.0 sub/eac_cli/lib/eac_cli/runner_with/input.rb
eac_tools-0.78.0 sub/eac_cli/lib/eac_cli/runner_with/input.rb
eac_tools-0.77.1 sub/eac_cli/lib/eac_cli/runner_with/input.rb
eac_tools-0.77.0 sub/eac_cli/lib/eac_cli/runner_with/input.rb
eac_cli-0.38.0 lib/eac_cli/runner_with/input.rb
eac_tools-0.76.1 sub/eac_cli/lib/eac_cli/runner_with/input.rb
eac_tools-0.76.0 sub/eac_cli/lib/eac_cli/runner_with/input.rb
eac_tools-0.75.2 sub/eac_cli/lib/eac_cli/runner_with/input.rb
eac_cli-0.37.0 lib/eac_cli/runner_with/input.rb
eac_tools-0.75.1 sub/eac_cli/lib/eac_cli/runner_with/input.rb
eac_tools-0.75.0 sub/eac_cli/lib/eac_cli/runner_with/input.rb
eac_tools-0.74.1 sub/eac_cli/lib/eac_cli/runner_with/input.rb