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.11.1 sub/eac_ruby_base0/lib/eac_ruby_base0/runner_with/input.rb
eac_tools-0.11.0 sub/eac_ruby_base0/lib/eac_ruby_base0/runner_with/input.rb
eac_tools-0.10.0 sub/eac_ruby_base0/lib/eac_ruby_base0/runner_with/input.rb
eac_tools-0.9.0 sub/eac_ruby_base0/lib/eac_ruby_base0/runner_with/input.rb
eac_ruby_base0-0.16.6 lib/eac_ruby_base0/runner_with/input.rb
eac_tools-0.8.0 sub/eac_ruby_base0/lib/eac_ruby_base0/runner_with/input.rb
eac_tools-0.7.0 sub/eac_ruby_base0/lib/eac_ruby_base0/runner_with/input.rb
eac_tools-0.6.0 sub/eac_ruby_base0/lib/eac_ruby_base0/runner_with/input.rb
eac_tools-0.5.0 sub/eac_ruby_base0/lib/eac_ruby_base0/runner_with/input.rb
eac_tools-0.4.0 sub/eac_ruby_base0/lib/eac_ruby_base0/runner_with/input.rb
eac_tools-0.3.0 sub/eac_ruby_base0/lib/eac_ruby_base0/runner_with/input.rb
eac_tools-0.2.2 sub/eac_ruby_base0/lib/eac_ruby_base0/runner_with/input.rb
eac_ruby_base0-0.16.5 lib/eac_ruby_base0/runner_with/input.rb
avm-tools-0.120.0 sub/eac_ruby_base0/lib/eac_ruby_base0/runner_with/input.rb
avm-tools-0.119.0 sub/eac_ruby_base0/lib/eac_ruby_base0/runner_with/input.rb
avm-tools-0.118.0 sub/eac_ruby_base0/lib/eac_ruby_base0/runner_with/input.rb
avm-tools-0.117.3 sub/eac_ruby_base0/lib/eac_ruby_base0/runner_with/input.rb
eac_ruby_base0-0.16.4 lib/eac_ruby_base0/runner_with/input.rb
avm-tools-0.117.2 sub/eac_ruby_base0/lib/eac_ruby_base0/runner_with/input.rb
eac_ruby_base0-0.16.3 lib/eac_ruby_base0/runner_with/input.rb