You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: help.rb
    path of file: ./repos/travis.rb/lib/travis/cli
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

require 'travis/cli'

module Travis
  module CLI
    class Help < Command
      description 'helps you out when in dire need of information'

      CommandGroup = Struct.new(:cmds, :header)

      def run(command = nil)
        if command
          say CLI.command(command).new.help
        else
          api_cmds   = CommandGroup.new(api_commands,   'API commands')
          repo_cmds  = CommandGroup.new(repo_comm
    
      def api_commands
        CLI.commands.select do |cmd|
          cmd.ancestors.include?(CLI::ApiCommand) &&
            !cmd.ancestors.include?(CLI::RepoCommand)
        end.sort_by { |c| c.command_name }
      end

      def repo_commands
        CLI.commands.select do |cmd|
          cmd.ancestors.include? CLI::RepoCommand
        end.sort_by { |c| c.command_name }
      end

      def other_commands
        CLI.commands.reject do |cmd|
          cmd.ancestors.include? CLI::ApiCommand
        end.sort_by { |c| c.command_name }
      end
    end
  end
end