blob: cfe08b7b8edfc368c5b6d838a3c8c0570d1490d4 [file] [log] [blame]
Luca Pretedce16f82016-11-22 13:11:56 -08001/*
2 * Copyright 2015-present Open Networking Laboratory
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.vpls.cli.completer;
17
18import com.google.common.collect.Lists;
19import org.onosproject.cli.AbstractChoicesCompleter;
20import org.onosproject.vpls.cli.VplsCommandEnum;
21
22import java.util.Collections;
23import java.util.List;
24
25/**
26 * VPLS command completer.
27 */
28public class VplsCommandCompleter extends AbstractChoicesCompleter {
29
30 @Override
31 public List<String> choices() {
32 List<String> argumentList =
33 Lists.newArrayList(getArgumentList().getArguments());
34 String argOne = null;
35 if (argumentList.size() > 1) {
36 argOne = argumentList.get(1);
37 }
38 VplsCommandEnum vplsCommandEnum = VplsCommandEnum.enumFromString(argOne);
39 if (vplsCommandEnum != null) {
40 switch (vplsCommandEnum) {
41 case CREATE:
42 case CLEAN:
43 case LIST:
44 return Collections.emptyList();
45 default:
46 VplsCommandEnum.toStringList();
47 }
48 }
49 return VplsCommandEnum.toStringList();
50 }
51}