Method: Gitlab::Help.actions_table

Defined in:
lib/gitlab/help.rb

.actions_table(topic = nil) ⇒ Terminal::Table

Table with available commands.

Returns:

  • (Terminal::Table)

60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/gitlab/help.rb', line 60

def actions_table(topic = nil)
  rows = topic ? help_map[topic] : help_map.keys
  table do |t|
    t.title = topic || 'Help Topics'

    # add_row expects an array and we have strings hence the map.
    rows.sort.map { |r| [r] }.each_with_index do |row, index|
      t.add_row row
      t.add_separator unless rows.size - 1 == index
    end
  end
end