blob: 134d995e4295f4858a1a5d2aacd7b0167a3a9d8c [file] [log] [blame]
alshabib144a2942014-09-25 18:44:02 -07001package org.onlab.onos.cli.net;
2
3import java.util.List;
4import java.util.SortedSet;
5
6import org.apache.karaf.shell.console.Completer;
7import org.apache.karaf.shell.console.completer.StringsCompleter;
8import org.onlab.onos.net.flow.FlowRule.FlowRuleState;
9
10/**
11 * Device ID completer.
12 */
13public class FlowRuleStatusCompleter implements Completer {
14 @Override
15 public int complete(String buffer, int cursor, List<String> candidates) {
16 // Delegate string completer
17 StringsCompleter delegate = new StringsCompleter();
18
19 FlowRuleState[] states = FlowRuleState.values();
20 SortedSet<String> strings = delegate.getStrings();
21 for (int i = 0; i < states.length; i++) {
22 strings.add(states[i].toString().toLowerCase());
23 }
24 strings.add(FlowsListCommand.ANY);
25
26 // Now let the completer do the work for figuring out what to offer.
27 return delegate.complete(buffer, cursor, candidates);
28 }
29
30}