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