Class: Snip::Command::List
- Inherits:
-
Object
- Object
- Snip::Command::List
- Defined in:
- lib/snip/command/list.rb
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(args = [], options = {}) ⇒ List
constructor
A new instance of List.
Constructor Details
#initialize(args = [], options = {}) ⇒ List
Returns a new instance of List.
6 7 8 9 |
# File 'lib/snip/command/list.rb', line 6 def initialize(args=[], ={}) @args = Array(args) @options = end |
Instance Method Details
#execute ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/snip/command/list.rb', line 11 def execute raise NotInitializedError unless Snip::initialized? Dir.foreach(Snip::INSTALL_DIR) do |file| next if file == '.' or file == '..' next unless @args.empty? || file.match(@args.first) first_line = "" File.open(File.join(Snip::INSTALL_DIR, file)) {|f| first_line = f.readline} printf("%-35s # %s", file.color(:blue), first_line); end end |