Class: Rupeepeethree::Cli

Inherits:
Object
  • Object
show all
Defined in:
lib/rupeepeethree.rb

Class Method Summary collapse

Class Method Details

.run(args) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/rupeepeethree.rb', line 8

def self.run(args)
  p = Optimist::Parser.new do
    version "RP3 version #{VERSION} by Tony Miller"
    banner "  \u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2588\u2591\u2580\u2580\u2588\n  \u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2591\u2580\u2584\n  \u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2591\u2580\u2580\u2591\n  \u2523\u00A8\uFF77\u2523\u00A8\uFF77\n  You thought your mp3s were cool. Turns out you were wrong. Your mp3s have no tags. You must tag them!\n    EOS\n    opt :title, \"title\", type: String, short: 't'\n    opt :artist, \"artist\", type: String, short: 'a'\n    opt :year, \"track year\", type: String, short: 'Y'\n    opt :track, \"track number\", type: String, short: 'n'\n    opt :album, \"album title\", type: String, short: 'A'\n    opt :picture, \"artwork\", type: String, short: 'p'\n    opt :clear, \"clear all tags!\"\n  end\n\n  opts = Optimist::with_standard_exception_handling p do\n    raise Optimist::HelpNeeded if ARGV.empty? # show help screen\n    p.parse ARGV\n  end\n\n  mp3s = ARGV\n  if mp3s.empty?\n    abort(\"no mp3 specified...\")\n  end\n  mp3s.each do |mp3|\n    if opts[:clear]\n      Tagger.clear(mp3)\n    else\n      Tagger.tag(mp3,opts)\n      puts Tagger.print_tags(mp3)\n    end\n  end\nend\n"