Sha256: 7be4c58a2ee638781eba40db7d8d763c001ff19aafa401d5b2e508edf5e1237f
Contents?: true
Size: 850 Bytes
Versions: 4
Compression:
Stored size: 850 Bytes
Contents
require_relative 'scripting/args_helpers' require_relative 'scripting/argument' require_relative 'scripting/arguments' module Eco #TODO integrate Thor to build the CLI from bottom to top on load class Scripting include Scripting::ArgsHelpers 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
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
eco-helpers-0.8.3 | lib/eco/scripting.rb |
eco-helpers-0.8.2 | lib/eco/scripting.rb |
eco-helpers-0.8.1 | lib/eco/scripting.rb |
eco-helpers-0.7.2 | lib/eco/scripting.rb |