Sha256: 6311c54074efe0f68dcbdc2003b147f0798e11daefbbf4d1dd7f8e9ecbc99982

Contents?: true

Size: 762 Bytes

Versions: 17

Compression:

Stored size: 762 Bytes

Contents

require_relative './scripting/arguments'

module Eco
  #TODO integrate Thor to build the CLI from bottom to top on load
  class Scripting
    include Scripting::Lib

    def args_contain?(*values)
      match?(ARGV, patterns, [:any, :or, :insensitive, :pattern])
    end

    def modifiers(*values)
      values.select { |arg| is_modifier?(arg) }
    end

    def args_filter_match(*values)
      modifier = Eco::Language::MatchModifier.new.any.or.insensitive
      patterns = modifier.to_regex(values)
      params = modifiers(*ARGV)
      patterns.each_with_index.reduce([]) { |done, (pat, i) |
        done.push(values[i]) if Handy.match?(params, pat, modifier)
        done
      }
    end

  end
end


SCR = Eco::Scripting.new

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
eco-helpers-0.7.1 lib/eco/scripting.rb
eco-helpers-0.6.17 lib/eco/scripting.rb
eco-helpers-0.6.16 lib/eco/scripting.rb
eco-helpers-0.6.15 lib/eco/scripting.rb
eco-helpers-0.6.13 lib/eco/scripting.rb
eco-helpers-0.6.12 lib/eco/scripting.rb
eco-helpers-0.6.11 lib/eco/scripting.rb
eco-helpers-0.6.9 lib/eco/scripting.rb
eco-helpers-0.6.8 lib/eco/scripting.rb
eco-helpers-0.6.7 lib/eco/scripting.rb
eco-helpers-0.6.6 lib/eco/scripting.rb
eco-helpers-0.6.5 lib/eco/scripting.rb
eco-helpers-0.6.4 lib/eco/scripting.rb
eco-helpers-0.6.3 lib/eco/scripting.rb
eco-helpers-0.6.2 lib/eco/scripting.rb
eco-helpers-0.6.1 lib/eco/scripting.rb
eco-helpers-0.6.0 lib/eco/scripting.rb