Sha256: 659b59e1909d88dda586f8018fddd15967431c89423711cccb8b99b7474429d8

Contents?: true

Size: 973 Bytes

Versions: 7

Compression:

Stored size: 973 Bytes

Contents

require 'warp/dir/command'
module Warp
  module Dir
    class Command
      class LS < ::Warp::Dir::Command
        description %q(List directory contents of a Warp Point)
        needs_a_point? true
        aliases :dir, :ll

        # @param [Object] args
        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
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
warp-dir-1.6.2 lib/warp/dir/command/ls.rb
warp-dir-1.6.1 lib/warp/dir/command/ls.rb
warp-dir-1.6.0 lib/warp/dir/command/ls.rb
warp-dir-1.5.0 lib/warp/dir/command/ls.rb
warp-dir-1.3.0 lib/warp/dir/command/ls.rb
warp-dir-1.2.0 lib/warp/dir/command/ls.rb
warp-dir-1.1.5 lib/warp/dir/command/ls.rb