Sha256: a3d6f7188bdc4ae505b62019b87a579972ccd684c0e1e0b5d8a280f81e5caba9

Contents?: true

Size: 971 Bytes

Versions: 1

Compression:

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

1 entries across 1 versions & 1 rubygems

Version Path
warp-dir-1.1.4 lib/warp/dir/command/ls.rb