application_help.rb 556 Bytes
Newer Older
James Fargher's avatar
James Fargher committed
1 2 3 4 5
# frozen_string_literal: true

module Gitlab
  module SlashCommands
    class ApplicationHelp < BaseCommand
6 7
      def initialize(project, params)
        @project = project
James Fargher's avatar
James Fargher committed
8 9 10 11
        @params = params
      end

      def execute
12 13 14
        Gitlab::SlashCommands::Presenters::Help
          .new(project, commands)
          .present(trigger, params[:text])
James Fargher's avatar
James Fargher committed
15 16 17 18 19 20 21 22 23 24 25 26 27 28
      end

      private

      def trigger
        "#{params[:command]} [project name or alias]"
      end

      def commands
        Gitlab::SlashCommands::Command.commands
      end
    end
  end
end