SHOW:
|
|
- or go back to the newest paste.
| 1 | module app; | |
| 2 | import jaster.cli; | |
| 3 | ||
| 4 | int main(string[] args) | |
| 5 | {
| |
| 6 | auto executor = new CommandLineInterface!(app); | |
| 7 | const statusCode = executor.parseAndExecute(args); | |
| 8 | ||
| 9 | UserIO.logInfof("Program exited with status code %s", statusCode);
| |
| 10 | ||
| 11 | return statusCode; | |
| 12 | } | |
| 13 | ||
| 14 | @Command(null, "The default command.") | |
| 15 | struct DefaultCommand | |
| 16 | {
| |
| 17 | @CommandPositionalArg(0, "number", "The number to check.") | |
| 18 | int number; | |
| 19 | ||
| 20 | int onExecute() | |
| 21 | {
| |
| 22 | return number % 2 == 0 ? 1 : 0; | |
| 23 | } | |
| 24 | } |