Class: Pakman::List

Inherits:
Object
  • Object
show all
Includes:
LogUtils::Logging, ManifestHelper
Defined in:
lib/pakman/cli/commands/list.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ManifestHelper

#installed_template_manifest_patterns, #installed_template_manifests

Constructor Details

#initialize(opts) ⇒ List

Returns a new instance of List.



9
10
11
# File 'lib/pakman/cli/commands/list.rb', line 9

def initialize( opts )
  @opts = opts
end

Instance Attribute Details

#optsObject (readonly)

Returns the value of attribute opts.



13
14
15
# File 'lib/pakman/cli/commands/list.rb', line 13

def opts
  @opts
end

Instance Method Details

#runObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/pakman/cli/commands/list.rb', line 15

def run
  manifests = installed_template_manifests
  
  puts 'Installed template packs in search path'
  
  installed_template_manifest_patterns.each_with_index do |pattern,i|
    puts "    [#{i+1}] #{pattern}"
  end
  puts '  include:'
  
  if manifests.empty?
    puts "    -- none --"    
  else
    manifests.each do |manifest|
      puts "%16s (%s)" % [manifest[0].gsub('.txt',''), manifest[1]]
    end
  end
end