This commit is contained in:
develar
2012-06-22 13:22:04 +04:00
parent 9443007dc3
commit 8d764af432
4 changed files with 23 additions and 20 deletions
@@ -17,6 +17,7 @@
package org.jetbrains.jet.cli.js;
import com.sampullara.cli.Argument;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.cli.common.CompilerArguments;
import org.jetbrains.k2js.facade.MainCallParameters;
@@ -53,8 +54,9 @@ public class K2JSCompilerArguments extends CompilerArguments {
@Argument(value = "version", description = "Display compiler version")
public boolean version;
@Argument(value = "mainCall", description = "Whether a main function should be invoked; either 'main' or 'mainWithArgs'")
public String mainCall;
@Nullable
@Argument(value = "main", description = "Whether a main function should be called; either 'call' or 'noCall', default 'call' (main function will be auto detected)")
public String main;
@Argument(value = "help", alias = "h", description = "Show help")
public boolean help;
@@ -85,15 +87,12 @@ public class K2JSCompilerArguments extends CompilerArguments {
}
public MainCallParameters createMainCallParameters() {
if (mainCall != null) {
if (mainCall.equals("main")) {
return MainCallParameters.mainWithoutArguments();
}
if (mainCall.equals("mainWithArgs")) {
// TODO should we pass the arguments to the compiler?
return MainCallParameters.mainWithArguments(new ArrayList<String>());
}
if ("noCall".equals(main)) {
return MainCallParameters.noCall();
}
else {
// TODO should we pass the arguments to the compiler?
return MainCallParameters.mainWithoutArguments();
}
return MainCallParameters.noCall();
}
}