gitlab-org--gitlab-foss/lib/gitlab/slash_commands/application_help.rb
Yorick Peterse e8dd299e7c
Improve chatops help output
This improves the output produced when running an unknown command,
running the "help" command, and when trying to run a command you are not
allowed to run. The new help output includes links to the project of the
chatops integration, and a link to the chatops documentation.
2019-08-29 16:11:42 +02:00

28 lines
556 B
Ruby

# frozen_string_literal: true
module Gitlab
module SlashCommands
class ApplicationHelp < BaseCommand
def initialize(project, params)
@project = project
@params = params
end
def execute
Gitlab::SlashCommands::Presenters::Help
.new(project, commands)
.present(trigger, params[:text])
end
private
def trigger
"#{params[:command]} [project name or alias]"
end
def commands
Gitlab::SlashCommands::Command.commands
end
end
end
end