Method: Ftpd::CmdHelp#cmd_help

Defined in:
lib/ftpd/cmd_help.rb

#cmd_help(argument) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/ftpd/cmd_help.rb', line 9

def cmd_help(argument)
  if argument
    target_command = argument.upcase
    if supported_commands.include?(target_command)
      reply "214 Command #{target_command} is recognized"
    else
      reply "214 Command #{target_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