Method: Gitlab::Help.get_help

Defined in:
lib/gitlab/help.rb

.get_help(cmd) ⇒ String

Returns the (modified) help from the ‘ri’ command or returns an error.

Returns:

  • (String)

13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/gitlab/help.rb', line 13

def get_help(cmd)
  cmd_namespace = namespace cmd

  if cmd_namespace
    ri_output = `#{ri_cmd} -T #{cmd_namespace} 2>&1`.chomp

    if $CHILD_STATUS == 0
      change_help_output! cmd, ri_output
      yield ri_output if block_given?

      ri_output
    else
      "Ri docs not found for #{cmd}, please install the docs to use 'help'."
    end
  else
    "Unknown command: #{cmd}."
  end
end