blob: 2157af4ba149f95d42588e5fd48c7e8ec9a81f52 [file] [log] [blame]
Kalhee Kimd94ceea2017-11-29 19:03:02 +00001/*
2 * Copyright 2017-present Open Networking Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.onosproject.dhcprelay.cli;
17
Ray Milkey86ad7bb2018-09-27 12:32:28 -070018import org.apache.karaf.shell.api.action.lifecycle.Service;
19import org.apache.karaf.shell.api.console.CommandLine;
20import org.apache.karaf.shell.api.console.Completer;
21import org.apache.karaf.shell.api.console.Session;
22import org.apache.karaf.shell.support.completers.StringsCompleter;
Kalhee Kimd94ceea2017-11-29 19:03:02 +000023
24import java.util.List;
25import java.util.SortedSet;
26
27/**
28 * Dhcp Relay counter completer.
29 */
Ray Milkey86ad7bb2018-09-27 12:32:28 -070030@Service
Kalhee Kimd94ceea2017-11-29 19:03:02 +000031public class DhcpRelayCounterCompleter implements Completer {
32
33 @Override
Ray Milkey86ad7bb2018-09-27 12:32:28 -070034 public int complete(Session session, CommandLine commandLine, List<String> candidates) {
Kalhee Kimd94ceea2017-11-29 19:03:02 +000035 // Delegate string completer
36 StringsCompleter delegate = new StringsCompleter();
37 SortedSet<String> strings = delegate.getStrings();
38 strings.add("counter");
39
40 // Now let the completer do the work for figuring out what to offer.
Ray Milkey86ad7bb2018-09-27 12:32:28 -070041 return delegate.complete(session, commandLine, candidates);
Kalhee Kimd94ceea2017-11-29 19:03:02 +000042 }
43}