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",
25 description = "add a description for the command")
26 public class ${classPrefix}CliTestCommand extends AbstractAction {
28 private static final Logger LOG = LoggerFactory.getLogger(${classPrefix}CliTestCommand.class);
29 protected final ${classPrefix}CliCommands service;
31 public ${classPrefix}CliTestCommand(final ${classPrefix}CliCommands service) {
32 this.service = service;
36 * Add the arguments required by the command.
37 * Any number of arguments can be added using the Option annotation
38 * The below argument is just an example and should be changed as per your requirements
41 aliases = { "--testArgument" },
42 description = "test command argument",
45 private Object testArgument;
48 protected Object doExecute() throws Exception {
50 * Invoke commannd implementation here using the service instance.
51 * Implement how you want the output of the command to be displayed.
52 * Below is just an example.
54 final String testMessage = (String) service.testCommand(testArgument);