Sha256: d00ba6010434d44fbb64563448db831cbddd0aa973516d7c768d6e59c36706f5

Contents?: true

Size: 799 Bytes

Versions: 11

Compression:

Stored size: 799 Bytes

Contents

require 'warp/dir/command'

require 'colored'
module Warp
  module Dir
    class Command
      class Warp < Warp::Dir::Command
        description %q(Jumps to the pre-defined warp point (command optional))
        needs_a_point? true

        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
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
warp-dir-1.7.0 lib/warp/dir/command/warp.rb
warp-dir-1.6.2 lib/warp/dir/command/warp.rb
warp-dir-1.6.1 lib/warp/dir/command/warp.rb
warp-dir-1.6.0 lib/warp/dir/command/warp.rb
warp-dir-1.5.0 lib/warp/dir/command/warp.rb
warp-dir-1.3.0 lib/warp/dir/command/warp.rb
warp-dir-1.2.0 lib/warp/dir/command/warp.rb
warp-dir-1.1.5 lib/warp/dir/command/warp.rb
warp-dir-1.1.4 lib/warp/dir/command/warp.rb
warp-dir-1.1.3 lib/warp/dir/command/warp.rb
warp-dir-1.1.2 lib/warp/dir/command/warp.rb