module GrooveDl::CLI

CLI module

Constants

SLOP_OPTIONS

Hash containing the default Slop options.

@return [Hash]

Public Class Methods

default_options() click to toggle source

@return [Slop]

# File lib/groove-dl/cli.rb, line 25
def self.default_options
  Slop.new(SLOP_OPTIONS.dup) do
    separator "\nOptions:\n"

    on :v, :version, 'Shows the current version' do
      puts CLI.version_information
    end

    on :p=, :playlist=, 'Playlist', as: Integer
    on :s=, :song=, 'Song', as: Integer
    on :o=, :output=, 'Output directory', as: String

    run do |opts|
      next if opts[:v]

      client = Grooveshark::Client.new
      d = Downloader.new(client, opts)
      if opts[:p]
        GrooveDl.configuration.logger
          .info("Download files into #{d.output_directory}")
        d.playlist(opts[:p])
      end

      d.song(opts[:s]) if opts[:s]
    end
  end
end
options() click to toggle source

@return [Slop]

# File lib/groove-dl/cli.rb, line 18
def self.options
  @options ||= default_options
end
version_information() click to toggle source

Returns a String containing some platform/version related information.

@return [String]

# File lib/groove-dl/cli.rb, line 58
def self.version_information
  "Groove-dl v#{VERSION} on #{RUBY_DESCRIPTION}"
end