timcolonel/wow

View on GitHub
lib/wow/general_options/source_options.rb

Summary

Maintainability
A
0 mins
Test Coverage
require 'wow'

# Options for command that need to interact with a server
class Wow::SourceOptions < Clin::GeneralOption
  option :source, 'Override all the sources'
  option :add_source, 'Add a source to the end of the source list', short: false, long: '--add-source'

  def execute(options)
    Wow.sources.replace(options[:source].split(',')) unless options[:source].nil?
    Wow.sources << options[:add_source] unless options[:add_source].nil?
  end
end