Module: Nehm::Help

Defined in:
lib/nehm/help.rb

Overview

Help module responds to ‘nehm help …’ command

Class Method Summary collapse

Class Method Details

.available_commandsObject



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/nehm/help.rb', line 4

def self.available_commands
  puts <<-HELP.gsub(/^ {8}/, '')
    #{Paint['nehm', :green]} is a console tool, which downloads, sets IDv3 tags and adds to your iTunes library your SoundCloud posts or likes in convenient way

    #{Paint['Avalaible nehm commands:', :yellow]}
      #{Paint['get', :green]}        Download, set tags and add to your iTunes library last post or like from your profile
      #{Paint['dl', :green]}         Download and set tags last post or like from your profile
      #{Paint['configure', :green]}  Configure application
      #{Paint['version', :green]}    Show version of installed nehm

    See #{Paint['nehm help [command]', :yellow]} to read about a specific subcommand
  HELP
end

.configureObject



33
34
35
36
37
38
39
40
# File 'lib/nehm/help.rb', line 33

def configure
  puts <<-CONFIGURE.gsub(/^ {8}/, '')
    #{Paint['Input:', :yellow]} nehm configure

    #{Paint['Summary:', :yellow]}
      Configuring nehm app
    CONFIGURE
end

.dlObject



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/nehm/help.rb', line 42

def dl
  puts <<-DL.gsub(/^ {8}/, '')
    #{Paint['Input:', :yellow]} nehm dl OPTIONS [from PERMALINK] [to PATH_TO_DIRECTORY] [playlist ITUNES_PLAYLIST]

    #{Paint['Summary:', :yellow]}
      Download tracks from SoundCloud and setting tags

    #{Paint['OPTIONS:', :yellow]}
      #{Paint['post', :green]}                       Do same with last post (track or repost) from your profile
      #{Paint['<number> posts', :green]}             Do same with last <number> posts from your profile
      #{Paint['like', :green]}                       Do same with your last like
      #{Paint['<number> likes', :green]}             Do same with your last <number> likes
      #{Paint['url', :magenta]}                        Do same with track from entered url

    #{Paint['Extra options:', :yellow]}
      #{Paint['from PERMALINK', :green]}             Do aforecited operations from custom user profile
      #{Paint['to PATH_TO_DIRECTORY', :green]}       Do aforecited operations to custom directory
      #{Paint['to current', :green]}                 Do aforecited operations to current working directory
      #{Paint['playlist ITUNES_PLAYLIST', :green]}   Do aforecited operations to custom iTunes playlist
  DL
end

.getObject



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/nehm/help.rb', line 64

def get
  puts <<-GET.gsub(/^ {8}/, '')
    #{Paint['Input:', :yellow]} nehm get OPTIONS [from PERMALINK] [to PATH_TO_DIRECTORY] [playlist ITUNES_PLAYLIST]

    #{Paint['Summary:', :yellow]}
      Download tracks, set tags and add to your iTunes library tracks from Soundcloud

    #{Paint['OPTIONS:', :yellow]}
      #{Paint['post', :green]}                       Do same with last post (track or repost) from your profile
      #{Paint['<number> posts', :green]}             Do same with last <number> posts from your profile
      #{Paint['like', :green]}                       Do same with your last like
      #{Paint['<number> likes', :green]}             Do same with your last <number> likes
      #{Paint['url', :magenta]}                        Do same with track from entered url

    #{Paint['Extra options:', :yellow]}
      #{Paint['from PERMALINK', :green]}             Do aforecited operations from profile with PERMALINK
      #{Paint['to PATH_TO_DIRECTORY', :green]}       Do aforecited operations to custom directory
      #{Paint['to current', :green]}                 Do aforecited operations to current working directory
      #{Paint['playlist ITUNES_PLAYLIST', :green]}   Do aforecited operations to custom iTunes playlist
  GET
end


86
87
88
89
90
91
# File 'lib/nehm/help.rb', line 86

def permalink
  puts <<-PERM.gsub(/^ {8}/, '')
    Permalink is the last word in your profile url
    Example: for profile url #{Paint['soundcloud.com/qwerty', :magenta]} permalink is #{Paint['qwerty', :magenta]}
  PERM
end

.show(command) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/nehm/help.rb', line 18

def self.show(command)
  case command
  when 'get', 'dl', 'configure', 'permalink'
    Help.send(command)
  when nil
    Help.available_commands
  else
    puts Paint["Command '#{command}' doesn't exist", :red]
    puts "\n"
    Help.available_commands
  end
end