Class: VimGet::Commands::UninstallCommand
- Inherits:
-
BaseCommand
- Object
- BaseCommand
- VimGet::Commands::UninstallCommand
- Defined in:
- lib/vimget/commands/uninstall_command.rb
Constant Summary
Constants inherited from BaseCommand
Instance Attribute Summary
Attributes inherited from BaseCommand
#command, #defaults, #options, #options_group, #program_name, #summary
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize ⇒ UninstallCommand
constructor
A new instance of UninstallCommand.
Methods inherited from BaseCommand
#arguments, #invoke, #show_help, #usage
Constructor Details
#initialize ⇒ UninstallCommand
Returns a new instance of UninstallCommand.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/vimget/commands/uninstall_command.rb', line 23 def initialize super("uninstall", "Uninstall a script") add_option("-i", "--id ID", Integer, "Indicated the id of script to uninstall") { |v,opts| opts[:uninstall_id] = v } add_option('--purge', 'Remove all associated files, including vim-get manifest') { |v,opts| opts[:purge] = v } add_option('--dry-run', 'Do not motify any files') { |v,opts| opts[:dry_run] = v } end |
Instance Method Details
#execute ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/vimget/commands/uninstall_command.rb', line 38 def execute if [:uninstall_id] script = VimGet.db.find_with_id([:uninstall_id]) else @rest.shift if @rest.first == "uninstall" raise CommandLineError, "Missing arguments" if @rest.empty? name = @rest.first script = VimGet.db.find(name) end if script.nil? raise UnknownScriptError, "This script is not installed yet." end installer = Installer.new() installer.uninstall(script) end |