forked from github/copilot-sdk-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCommandHandler.java
More file actions
41 lines (37 loc) · 1.24 KB
/
CommandHandler.java
File metadata and controls
41 lines (37 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------------------------------------------*/
package com.github.copilot.sdk.json;
import java.util.concurrent.CompletableFuture;
/**
* Functional interface for handling slash-command executions.
* <p>
* Implement this interface to define the behavior of a registered slash
* command. The handler is invoked when the user executes the command in the CLI
* TUI.
*
* <h2>Example Usage</h2>
*
* <pre>{@code
* CommandHandler deployHandler = context -> {
* System.out.println("Deploying with args: " + context.getArgs());
* // perform deployment...
* return CompletableFuture.completedFuture(null);
* };
* }</pre>
*
* @see CommandDefinition
* @since 1.0.0
*/
@FunctionalInterface
public interface CommandHandler {
/**
* Handles a slash-command execution.
*
* @param context
* the command context containing session ID, command text, and
* arguments
* @return a future that completes when the command handling is done
*/
CompletableFuture<Void> handle(CommandContext context);
}