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; |
tom | 5ac5188 | 2014-08-27 18:10:33 -0700 | [diff] [blame] | 5 | import org.onlab.onos.GreetService; |
tom | 0eb04ca | 2014-08-25 14:34:51 -0700 | [diff] [blame] | 6 | |
| 7 | /** |
| 8 | * Simple command example to demonstrate use of Karaf shell extensions; shows |
| 9 | * use of an optional parameter as well. |
| 10 | */ |
| 11 | @Command(scope = "onos", name = "greet", description = "Issues a greeting") |
tom | 6d2a43e | 2014-09-08 01:50:20 -0700 | [diff] [blame^] | 12 | public class GreetCommand extends AbstractShellCommand { |
tom | 0eb04ca | 2014-08-25 14:34:51 -0700 | [diff] [blame] | 13 | |
| 14 | @Argument(index = 0, name = "name", description = "Name to greet", |
| 15 | required = false, multiValued = false) |
| 16 | String name = "dude"; |
| 17 | |
| 18 | @Override |
| 19 | protected Object doExecute() throws Exception { |
tom | 6d2a43e | 2014-09-08 01:50:20 -0700 | [diff] [blame^] | 20 | print(getService(GreetService.class).yo(name)); |
tom | 0eb04ca | 2014-08-25 14:34:51 -0700 | [diff] [blame] | 21 | return null; |
| 22 | } |
| 23 | } |