Module: BandCamp::Cli::Options

Defined in:
lib/band_camp/cli/options.rb

Class Method Summary collapse

Class Method Details

.extract_from_argvObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/band_camp/cli/options.rb', line 6

def self.extract_from_argv
  options = {}
  options[:debug] = true

  OptionParser.new do |opts|
    opts.banner = "Usage: example.rb [options]"

    opts.on("-d", "--[no-]debug", "Output debug information") do |v|
      options[:debug] = v
    end

    opts.on("-a", "--all", "If the url does not contain songs but links to tracks/albums: download all those") do |v|
      options[:all] = v
    end
  end.parse!
  options
end