Sha256: 4e0046f352e7259ed58eebdd9798ab9bd3e672a04b000dcd128c7ae53672735b

Contents?: true

Size: 694 Bytes

Versions: 6

Compression:

Stored size: 694 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(StringIO.new(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

6 entries across 6 versions & 2 rubygems

Version Path
ftpd-1.1.1 lib/ftpd/cmd_list.rb
ftpd-1.1.0 lib/ftpd/cmd_list.rb
investtools-ftpd-1.0.1 lib/ftpd/cmd_list.rb
ftpd-1.0.1 lib/ftpd/cmd_list.rb
ftpd-1.0.0 lib/ftpd/cmd_list.rb
ftpd-0.17.0 lib/ftpd/cmd_list.rb