Sha256: b9f00d042e41353f59d4e259b2d08d5b4bea2e426c2c544656cbefbac6ecec71

Contents?: true

Size: 1.32 KB

Versions: 65

Compression:

Stored size: 1.32 KB

Contents

# frozen_string_literal: true

require 'eac_cli/runner'
require 'eac_ruby_utils/core_ext'
require 'eac_fs/traversable'
require 'eac_ruby_utils/settings_provider'

module EacRubyBase0
  module RunnerWith
    module FilesystemTraverser
      DEFAULT_DEFAULT_TRAVERSER_RECURSIVE = false

      common_concern do
        include ::EacCli::Runner
        include ::EacFs::Traversable
        enable_settings_provider
        include TopMethods
        runner_definition do
          bool_opt '-R', '--recursive', 'Recursive.'
          bool_opt '--no-recursive', 'No recursive.'
          pos_arg :paths, optional: true, repeat: true
        end
      end

      module TopMethods
        def on_none_path_informed
          infom 'Warning: none path informed'
        end

        def paths
          parsed.paths.map(&:to_pathname)
        end

        def run_filesystem_traverser
          if parsed.paths.any?
            parsed.paths.each { |path| traverser_check_path(path) }
          else
            on_none_path_informed
          end
        end

        def traverser_recursive
          return false if parsed.no_recursive?
          return true if parsed.recursive?

          setting_value(:default_traverser_recursive, required: false)
            .if_not_nil(DEFAULT_DEFAULT_TRAVERSER_RECURSIVE)
        end
      end
    end
  end
end

Version data entries

65 entries across 65 versions & 4 rubygems

Version Path
avm-tools-0.113.3 sub/eac_ruby_base0/lib/eac_ruby_base0/runner_with/filesystem_traverser.rb
eac_ruby_base0-0.13.2 lib/eac_ruby_base0/runner_with/filesystem_traverser.rb
avm-tools-0.113.2 sub/eac_ruby_base0/lib/eac_ruby_base0/runner_with/filesystem_traverser.rb
eac_ruby_base0-0.13.1 lib/eac_ruby_base0/runner_with/filesystem_traverser.rb
ehbrs-tools-0.28.3 vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/filesystem_traverser.rb