In a command line Java application you can get arguments through the args parameter:
public static void main(String[] args) {
How can I do something similar in Ceylon? I tried copying the Java style:
shared void run(String[] args) {
but got an error since that is not allowed:
ceylon run: Cannot run toplevel method 'test.project.run':
it should have no parameters or they should all have default values.
I've been reading the ceylon-lang.org tour but I haven't found the answer.
Use the top-level process object in the language module.
String[] arguments = process.arguments;
String? argument = process.namedArgumentValue("name");
if (process.namedArgumentPresent("name")) {
// ...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With