module Eco class CLI class Config class Filters class InputFilters < Eco::CLI::Config::Filters def help(refine: nil) refinement = refine.is_a?(String)? " (containing: '#{refine}')" : "" super("The following are the available filters on the input entries#{refinement}:", refine: refine) end def process(io:) unless io && io.is_a?(Eco::API::UseCases::BaseIO) raise "You need to provide Eco::API::UseCases::BaseIO object. Given: #{io.class}" end io = io.new(type: :import) @filters.each do |arg, callback| if SCR.get_arg(arg) io = io.new(input: callback.call(*io.params)) end end io.input end end end end end end