bin/musk

Summary

Maintainability
Test Coverage
#!/usr/bin/env ruby

require "gli"
require "musk"

extend GLI::App

program_desc "Extract tags from MP3 files and perfume MP3 files with fragrant tags."

desc "Extract tags from MP3 files"
arg_name "path_to_files"
command :extract do |command|
  command.arg_name "csv|pretty"
  command.default_value "pretty"
  command.flag [:f, :format]
  command.action do |global_options, options, arguments|
    begin
      tracks = Musk::TrackLoader.load!(arguments.first)
      Musk::TrackPrinter.print!(options[:f], tracks)
    rescue RuntimeError => error
      STDERR.puts error
      exit 1
    end
  end
end

exit run(ARGV)