Class: Warp::Dir::Command::LS

Inherits:
Warp::Dir::Command show all
Defined in:
lib/warp/dir/command/ls.rb

Instance Attribute Summary

Attributes inherited from Warp::Dir::Command

#formatter, #point, #point_name, #point_path, #store

Instance Method Summary collapse

Methods inherited from Warp::Dir::Command

command_name, #config, help, inherited, #initialize, #inspect, installed_commands, #needs_point?, #on, #puts

Constructor Details

This class inherits a constructor from Warp::Dir::Command

Instance Method Details

#run(opts, *flags) ⇒ Object

Parameters:



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/warp/dir/command/ls.rb', line 11

def run(opts, *flags)
  point         = store.find_point(point_name)
  STDERR.puts "FLAGS: [#{flags}]".bold.green if config.debug

  command_flags = if flags && !flags.empty?
                    flags
                  else
                    ['-al']
                  end
  command = "ls #{command_flags.join(' ')} #{point.path}/"
  STDERR.puts 'Command: '.yellow + command.bold.green if config.debug
  ls_output     = `#{command}`
  STDERR.puts 'Output:  '.yellow + ls_output.bold.blue if config.debug
  on :success do
    message ls_output.bold
  end
end