* Contact:
* Kangho Kim <kh5325.kim@samsung.com>
* Hyunsik Noh <hyunsik.noh@samsung.com>
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
{ "list", "target", "app" },
{ "create", "web-project native-project security-profile security-profile-item certificate" },
{ "help", commands } };
-
+
public static String[][] options = {
{ "cli-config", "--list --global" },
{ "build-native", "--predefine-option --arch --compiler --configuration" },
architecture(options[1][0], "--arch", "x86 arm"),
compiler(options[1][0], "--compiler", "llvm gcc"),
configuration(options[1][0], "--configuration", "Debug Release DA"),
- webtemplate(optionsForSub[0][0], "-t", ""),
- nativetemplate(optionsForSub[1][0], "-t", "");
+ webtemplate(subCommands[1][0], optionsForSub[0][0], "-t", ""),
+ nativetemplate(subCommands[1][0], optionsForSub[1][0], "-t", "");
private String mainCmd;
+ private String subCmd;
private String option;
private String suggestion;
this.suggestion = suggestion;
}
+ private OptionSuggestion(String mainCmd, String subCmd, String option, String suggestion) {
+ this.mainCmd = mainCmd;
+ this.subCmd = subCmd;
+ this.option = option;
+ this.suggestion = suggestion;
+ }
+
+ public String getMainCmd(){
+ return mainCmd;
+ }
+
+ public String getSubCmd(){
+ return subCmd;
+ }
+
public String getSuggestion() {
return suggestion;
}
public static void main(String[] args) {
String[] inputs = args;
+ String mainCmd = null;
+ String subCmd = null;
+ boolean needSubCmd = false;
+
int count = inputs.length;
+
+ if (count > 1) {
+ mainCmd = inputs[1];
+ if ((needSubCmd = hasSub(mainCmd))) {
+ if (count > 2) {
+ subCmd = inputs[2];
+ }
+ }
+ }
+
if (count > 2) {
boolean needSuggestion = false;
OptionSuggestion input = null;
for (OptionSuggestion optionFortSuggestion : OptionSuggestion.values()) {
if (optionFortSuggestion.getOption().equals(inputs[count - 1])) {
- needSuggestion = true;
- input = optionFortSuggestion;
- break;
+ if(optionFortSuggestion.getMainCmd() == null || optionFortSuggestion.getMainCmd().equals(mainCmd)){
+ if(optionFortSuggestion.getSubCmd() == null || optionFortSuggestion.getSubCmd().equals(subCmd)){
+ needSuggestion = true;
+ input = optionFortSuggestion;
+ break;
+ }
+ }
}
}
if (needSuggestion) {
}
}
- String mainCmd = null;
- String subCmd = null;
- boolean needSubCmd = false;
- if (count > 1) {
- mainCmd = inputs[1];
- if ((needSubCmd = hasSub(mainCmd))) {
- if (count > 2) {
- subCmd = inputs[2];
- }
- }
- }
System.out.println(getNext(inputs, count, needSubCmd, mainCmd, subCmd));
return;
}
suggestion = optionFortSuggestion.getSuggestion();
break;
case webtemplate:
- System.out.println("WEBTEMPLATE");
List<String> listResult = CreateProjectCommandData.getTemplateList();
for (String result : listResult) {
suggestion = suggestion + " " + result;
suggestion = suggestion.trim();
break;
case nativetemplate:
- System.out.println("NATIVEEMPLATE");
List<String> nativelistResult = CreateNativeProjectCommandData.getTemplateList();
for (String result : nativelistResult) {
suggestion = suggestion + " " + result;
}
suggestion = suggestion.trim();
break;
- }
+ }
return suggestion;
}
}