class AnyStyle::CLI::Commands::Parse

Public Instance Methods

run(args, params) click to toggle source
# File lib/anystyle/cli/commands/parse.rb, line 5
def run(args, params)
  set_output_folder args[1]
  walk args[0] do |path, base_path|
    say "Parsing #{path.relative_path_from(base_path)} ..."
    dataset = parse(path.to_s.untaint)
    say "#{dataset.length} references found."
    each_format do |fmt|
      res = format(dataset, fmt)
      out = extsub(path, ".#{fmt}")
      say "Writing #{out.relative_path_from(base_path)} ..."
      write res, out, base_path
    end
  end
end