Sha256: 2ac8f7b73fa7a38a7b99d054301024677b6bdf64f0575c42e9cbc0dcdf0d779e

Contents?: true

Size: 704 Bytes

Versions: 6

Compression:

Stored size: 704 Bytes

Contents

# frozen_string_literal: true

require_relative 'command_handler'

module Ftpd

  class CmdHelp < CommandHandler

    def cmd_help(argument)
      if argument
        command = argument.upcase
        if supported_commands.include?(command)
          reply "214 Command #{command} is recognized"
        else
          reply "214 Command #{command} is not recognized"
        end
      else
        reply '214-The following commands are recognized:'
        supported_commands.sort.each_slice(8) do |commands|
          line = commands.map do |command|
            '   %-4s' % command
          end.join
          reply line
        end
        reply '214 Have a nice day.'
      end
    end

  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ftpd-2.0.5 lib/ftpd/cmd_help.rb
ftpd-2.0.4 lib/ftpd/cmd_help.rb
ftpd-2.0.3 lib/ftpd/cmd_help.rb
ftpd-2.0.2 lib/ftpd/cmd_help.rb
ftpd-2.0.1 lib/ftpd/cmd_help.rb
ftpd-2.0.0 lib/ftpd/cmd_help.rb