tom | 0eb04ca | 2014-08-25 14:34:51 -0700 | [diff] [blame] | 1 | package org.onlab.onos.cli; |
| 2 | |
| 3 | import org.apache.karaf.shell.commands.Argument; |
| 4 | import org.apache.karaf.shell.commands.Command; |
| 5 | import org.apache.karaf.shell.console.OsgiCommandSupport; |
tom | 5ac5188 | 2014-08-27 18:10:33 -0700 | [diff] [blame^] | 6 | import org.onlab.onos.GreetService; |
tom | 0eb04ca | 2014-08-25 14:34:51 -0700 | [diff] [blame] | 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") |
| 13 | public 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 | } |