File tree 2 files changed +16
-6
lines changed
mcp-cli/src/main/java/software/amazon/smithy/java/mcp/cli/commands
mcp-cli-api/src/main/java/software/amazon/smithy/java/mcp/cli
2 files changed +16
-6
lines changed Original file line number Diff line number Diff line change 8
8
import static software .amazon .smithy .java .mcp .cli .ConfigUtils .loadOrCreateConfig ;
9
9
10
10
import java .util .concurrent .Callable ;
11
+ import picocli .CommandLine ;
11
12
import software .amazon .smithy .java .logging .InternalLogger ;
12
13
import software .amazon .smithy .java .mcp .cli .model .Config ;
13
14
20
21
*/
21
22
public abstract class SmithyMcpCommand implements Callable <Integer > {
22
23
24
+ @ CommandLine .Spec
25
+ CommandLine .Model .CommandSpec commandSpec ;
26
+
23
27
InternalLogger LOG = InternalLogger .getLogger (SmithyMcpCommand .class );
24
28
25
29
@ Override
@@ -50,4 +54,8 @@ public final Integer call() throws Exception {
50
54
protected String registryToUse (Config config ) {
51
55
return config .getDefaultRegistry ();
52
56
}
57
+
58
+ protected final CommandLine .Model .CommandSpec commandSpec () {
59
+ return commandSpec ;
60
+ }
53
61
}
Original file line number Diff line number Diff line change @@ -25,13 +25,15 @@ protected void execute(ExecutionContext context) {
25
25
registry
26
26
.listMcpBundles ()
27
27
.forEach (bundle -> {
28
- StringBuilder builder = new StringBuilder (bundle .getName ());
29
- if (bundle .getDescription () != null ) {
30
- builder .append ("\n " ).append ("Description: " ).append (bundle .getDescription ());
31
- } else {
32
- builder .append ("\n " ).append ("MCP for " ).append (bundle .getName ());
28
+ System .out .println (commandSpec ().commandLine ()
29
+ .getColorScheme ()
30
+ .string ("@|bold " + bundle .getName () + "|@" ));
31
+ var description = bundle .getDescription ();
32
+ if (description == null ) {
33
+ description = "MCP server for " + bundle .getName ();
33
34
}
34
- System .out .println (builder );
35
+ System .out .print ("\t Description: " );
36
+ System .out .println (description );
35
37
});
36
38
37
39
}
You can’t perform that action at this time.
0 commit comments