class PathExpander
def process_args
def process_args pos_files = [] neg_files = [] flags = [] clean = true args.each do |arg| case arg when /^@(.*)/ then # push back on, so they can have dirs/-/@ as well clean = false args.concat process_file $1 when "-" then pos_files << arg when /^-(.*)/ then if File.exist? $1 then clean = false neg_files += expand_dirs_to_files($1) else flags << arg end else root_path = File.expand_path(arg) == "/" # eg: -n /./ if File.exist? arg and not root_path then clean = false pos_files += expand_dirs_to_files(arg) else flags << arg end end end files = pos_files - neg_files files += expand_dirs_to_files(self.path) if files.empty? && clean [files, flags] end