blob: dd8ae8174534594cde1e03a5d59b2b3f529f210b [file] [log] [blame]
tom0eb04ca2014-08-25 14:34:51 -07001package org.onlab.onos.cli;
2
3import org.apache.karaf.shell.commands.Argument;
4import org.apache.karaf.shell.commands.Command;
5import org.apache.karaf.shell.console.OsgiCommandSupport;
6import org.onlab.onos.net.GreetService;
7
8/**
9 * Simple command example to demonstrate use of Karaf shell extensions; shows
10 * use of an optional parameter as well.
11 */
12@Command(scope = "onos", name = "greet", description = "Issues a greeting")
13public class GreetCommand extends OsgiCommandSupport {
14
15 @Argument(index = 0, name = "name", description = "Name to greet",
16 required = false, multiValued = false)
17 String name = "dude";
18
19 @Override
20 protected Object doExecute() throws Exception {
21 System.out.println(getService(GreetService.class).yo(name));
22 return null;
23 }
24}