lib/terraspace/cli/list.rb in terraspace-0.2.4 vs lib/terraspace/cli/list.rb in terraspace-0.3.0
- old
+ new
@@ -1,13 +1,26 @@
class Terraspace::CLI
class List
def initialize(options={})
@options = options
+ @type_dir = normalized_type
end
def run
Dir.glob("{app,vendor}/{modules,stacks}/*").sort.each do |path|
- puts path
+ if @type_dir
+ puts path if path.include?("/#{@type_dir}/")
+ else
+ puts path
+ end
+ end
+ end
+
+ private
+ def normalized_type
+ type = @options[:type]
+ if %w[stack module].include?(type)
+ type.pluralize
end
end
end
end