Class: Commands::Unsource
Instance Method Summary collapse
-
#initialize(base_command) ⇒ Unsource
constructor
A new instance of Unsource.
- #options ⇒ Object
- #parse!(args) ⇒ Object
Constructor Details
#initialize(base_command) ⇒ Unsource
Returns a new instance of Unsource.
604 605 606 |
# File 'lib/commands/plugin.rb', line 604 def initialize(base_command) @base_command = base_command end |
Instance Method Details
#options ⇒ Object
608 609 610 611 612 613 614 615 616 |
# File 'lib/commands/plugin.rb', line 608 def OptionParser.new do |o| o.set_summary_indent(' ') o. = "Usage: #{@base_command.script_name} source URI [URI [URI]...]" o.define_head "Remove repositories from the default search list." o.separator "" o.on_tail("-h", "--help", "Show this help message.") { puts o; exit } end end |
#parse!(args) ⇒ Object
618 619 620 621 622 623 624 625 626 627 628 629 630 631 |
# File 'lib/commands/plugin.rb', line 618 def parse!(args) .parse!(args) count = 0 args.each do |uri| if Repositories.instance.remove(uri) count += 1 puts "removed: #{uri.ljust(50)}" else puts "failed: #{uri.ljust(50)}" end end Repositories.instance.save puts "Removed #{count} repositories." end |