Class: VimGet::Commands::ListCommand
- Inherits:
-
BaseCommand
- Object
- BaseCommand
- VimGet::Commands::ListCommand
- Defined in:
- lib/vimget/commands/list_command.rb
Direct Known Subclasses
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(name = 'list', summary = 'Display all script in local') ⇒ ListCommand
constructor
A new instance of ListCommand.
- #usage ⇒ Object
Methods inherited from BaseCommand
#arguments, #invoke, #show_help
Constructor Details
#initialize(name = 'list', summary = 'Display all script in local') ⇒ ListCommand
Returns a new instance of ListCommand.
14 15 16 17 18 19 20 |
# File 'lib/vimget/commands/list_command.rb', line 14 def initialize(name = 'list', summary = 'Display all script in local') super(name, summary, :format => "plain") end |
Instance Method Details
#execute ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/vimget/commands/list_command.rb', line 26 def execute raise CommandLineError, "Ambiguous command!" if [:outdated] && [:installed] if [:outdated] puts "List outdated scripts" scripts = VimGet.db.outdated_scripts elsif [:installed] puts "List installed scripts" scripts = VimGet.db.installed_scripts else puts "List scripts" scripts = VimGet.db.search end scripts.each do |s| if [:format] == "plain" puts "[#{s.name}]" puts "id: #{s.sid}" puts "author: #{s.author}" puts "installed: #{s.installed}" puts "version: #{s.version}" puts #elsif @options[:format] == "xml" # puts "<script name=\"#{s.name}\" id=\"#{s.sid}\">" # puts "</script>" end end end |
#usage ⇒ Object
22 23 24 |
# File 'lib/vimget/commands/list_command.rb', line 22 def usage "#{program_name} [STRING]" end |