在命令行Java应用程序中,您可以通过args参数获取参数:
public static void main(String[] args) {
Run Code Online (Sandbox Code Playgroud)
我怎样才能在锡兰做类似的事情?我尝试复制Java风格:
shared void run(String[] args) {
Run Code Online (Sandbox Code Playgroud)
但是因为不允许这样做有错误:
ceylon run: Cannot run toplevel method 'test.project.run':
it should have no parameters or they should all have default values.
Run Code Online (Sandbox Code Playgroud)
我一直在阅读ceylon-lang.org之旅,但我没有找到答案.
使用process语言模块中的顶级对象.
String[] arguments = process.arguments;
String? argument = process.namedArgumentValue("name");
if (process.namedArgumentPresent("name")) {
// ...
}
Run Code Online (Sandbox Code Playgroud)