Sha256: 0321cad4e7e707dd6a4d6f1672759bea5263f049aeb70a63f809cd3384566a9b

Contents?: true

Size: 966 Bytes

Versions: 4

Compression:

Stored size: 966 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

        # @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

4 entries across 4 versions & 1 rubygems

Version Path
warp-dir-1.1.3 lib/warp/dir/command/ls.rb
warp-dir-1.1.2 lib/warp/dir/command/ls.rb
warp-dir-1.1.1 lib/warp/dir/command/ls.rb
warp-dir-1.1.0 lib/warp/dir/command/ls.rb