1 #set( $symbol_pound = '#' )
2 #set( $symbol_dollar = '$' )
3 #set( $symbol_escape = '\' )
5 * Copyright © ${copyrightYear} ${copyright} and others. All rights reserved.
7 * This program and the accompanying materials are made available under the
8 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
9 * and is available at http://www.eclipse.org/legal/epl-v10.html
11 package ${package}.cli.commands;
13 import org.apache.karaf.shell.commands.Command;
14 import org.apache.karaf.shell.commands.Option;
15 import org.apache.karaf.shell.console.AbstractAction;
16 import ${package}.cli.api.${classPrefix}CliCommands;
17 import org.slf4j.Logger;
18 import org.slf4j.LoggerFactory;
21 * This is an example class. The class name can be renamed to match the command implementation that it will invoke.
22 * Specify command details by updating the fields in the Command annotation below.
24 @Command(name = "test-command", scope = "add the scope of the command, usually project name", description = "add a description for the command")
25 public class ${classPrefix}CliTestCommand extends AbstractAction {
27 private static final Logger LOG = LoggerFactory.getLogger(${classPrefix}CliTestCommand.class);
28 protected final ${classPrefix}CliCommands service;
30 public ${classPrefix}CliTestCommand(final ${classPrefix}CliCommands service) {
31 this.service = service;
35 * Add the arguments required by the command.
36 * Any number of arguments can be added using the Option annotation
37 * The below argument is just an example and should be changed as per your requirements
40 aliases = { "--testArgument" },
41 description = "test command argument",
44 private Object testArgument;
47 protected Object doExecute() throws Exception {
49 * Invoke commannd implementation here using the service instance.
50 * Implement how you want the output of the command to be displayed.
51 * Below is just an example.
53 final String testMessage = (String) service.testCommand(testArgument);