Sha256: 4ddd9bc132273003bfd8ee6272bdc2c32e99a47778fb55e309ccd24f790183dd

Contents?: true

Size: 680 Bytes

Versions: 5

Compression:

Stored size: 680 Bytes

Contents

require_relative 'command_handler'

module Ftpd

  class CmdList < CommandHandler

    def cmd_list(argument)
      close_data_server_socket_when_done do
        ensure_logged_in
        ensure_file_system_supports :dir
        ensure_file_system_supports :file_info
        path = list_path(argument)
        path = File.expand_path(path, name_prefix)
        transmit_file(list(path), 'A')
      end
    end

    private

    def list(path)
      format_list(path_list(path))
    end

    def format_list(paths)
      paths.map do |path|
        file_info = file_system.file_info(path)
        config.list_formatter.new(file_info).to_s + "\n"
      end.join
    end

  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ftpd-0.16.0 lib/ftpd/cmd_list.rb
ftpd-0.15.0 lib/ftpd/cmd_list.rb
ftpd-0.14.0 lib/ftpd/cmd_list.rb
ftpd-0.13.0 lib/ftpd/cmd_list.rb
ftpd-0.12.0 lib/ftpd/cmd_list.rb