Sha256: 6e5baf2489ab476e40f5bcf62167f28b8dec2365b56a8c945d3e93411c14d57a

Contents?: true

Size: 832 Bytes

Versions: 167

Compression:

Stored size: 832 Bytes

Contents

# frozen_string_literal: true

require 'eac_cli/runner'
require 'eac_ruby_utils/core_ext'
require 'eac_ruby_utils/abstract_methods'

module EacRubyBase0
  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

167 entries across 167 versions & 4 rubygems

Version Path
eac_tools-0.61.1 sub/eac_ruby_base0/lib/eac_ruby_base0/runner_with/input.rb
eac_tools-0.61.0 sub/eac_ruby_base0/lib/eac_ruby_base0/runner_with/input.rb
eac_tools-0.60.3 sub/eac_ruby_base0/lib/eac_ruby_base0/runner_with/input.rb
eac_tools-0.60.2 sub/eac_ruby_base0/lib/eac_ruby_base0/runner_with/input.rb
eac_tools-0.60.1 sub/eac_ruby_base0/lib/eac_ruby_base0/runner_with/input.rb
eac_tools-0.60.0 sub/eac_ruby_base0/lib/eac_ruby_base0/runner_with/input.rb
eac_tools-0.59.0 sub/eac_ruby_base0/lib/eac_ruby_base0/runner_with/input.rb
eac_tools-0.58.0 sub/eac_ruby_base0/lib/eac_ruby_base0/runner_with/input.rb
eac_tools-0.57.0 sub/eac_ruby_base0/lib/eac_ruby_base0/runner_with/input.rb
eac_tools-0.56.1 sub/eac_ruby_base0/lib/eac_ruby_base0/runner_with/input.rb
eac_tools-0.56.0 sub/eac_ruby_base0/lib/eac_ruby_base0/runner_with/input.rb
eac_tools-0.55.7 sub/eac_ruby_base0/lib/eac_ruby_base0/runner_with/input.rb
eac_tools-0.55.6 sub/eac_ruby_base0/lib/eac_ruby_base0/runner_with/input.rb
eac_tools-0.55.5 sub/eac_ruby_base0/lib/eac_ruby_base0/runner_with/input.rb
eac_tools-0.55.4 sub/eac_ruby_base0/lib/eac_ruby_base0/runner_with/input.rb
eac_tools-0.55.3 sub/eac_ruby_base0/lib/eac_ruby_base0/runner_with/input.rb
eac_tools-0.55.2 sub/eac_ruby_base0/lib/eac_ruby_base0/runner_with/input.rb
eac_ruby_base0-0.17.3 lib/eac_ruby_base0/runner_with/input.rb
eac_ruby_base0-0.17.2 lib/eac_ruby_base0/runner_with/input.rb
eac_tools-0.55.1 sub/eac_ruby_base0/lib/eac_ruby_base0/runner_with/input.rb