blob: b14615d4981d961e502df328539057a1fa99bb35 [file] [log] [blame]
Michele Santuari05b882c2015-11-25 09:40:46 +01001package org.onosproject.cli.net;
2
3import org.apache.karaf.shell.console.Completer;
4import org.apache.karaf.shell.console.completer.StringsCompleter;
5import org.onosproject.net.EncapsulationType;
6
7import java.util.List;
8import java.util.SortedSet;
9
10/**
11 * Encapsulation type completer.
12 */
13public class EncapTypeCompleter implements Completer {
14
15 @Override
16 public int complete(String buffer, int cursor, List<String> candidates) {
17 // Delegate string completer
18 StringsCompleter delegate = new StringsCompleter();
19 SortedSet<String> strings = delegate.getStrings();
20
21 for (EncapsulationType encapType : EncapsulationType.values()) {
22 strings.add(encapType.toString());
23 }
24
25 // Now let the completer do the work for figuring out what to offer.
26 return delegate.complete(buffer, cursor, candidates);
27 }
28}