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

Inherits:
Warp::Dir::Command show all
Defined in:
lib/warp/dir/command/warp.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(*args) ⇒ Object



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

def run(*args)
  if point.nil? && point_name
    begin
      self.point = store[point_name]
    rescue ::Warp::Dir::Errors::PointNotFound
    end
  end
  warp_to_path = if point
    point.absolute_path
  else
    point_name if ::Dir.exist?(point_name.to_s)
  end
  raise ::Warp::Dir::Errors::PointNotFound.new(point_name) unless warp_to_path
  on :shell do
    message "cd #{warp_to_path}"
  end
end