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.



11
12
13
# File 'lib/pakman/cli/commands/list.rb', line 11

def initialize( opts )
  @opts = opts
end

Instance Attribute Details

#optsObject (readonly)

Returns the value of attribute opts.



15
16
17
# File 'lib/pakman/cli/commands/list.rb', line 15

def opts
  @opts
end

Instance Method Details

#runObject



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

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