1 module commands;
2 
3 import jaster.cli;
4 
5 // For named/subcommands, provide a pattern as the first paramter.
6 //
7 // Patterns follow a really simple format:
8 //      - "abc" matches "abc"
9 //      - "abc|efg" matches either "abc" or "efg"
10 //
11 // So for this command, we match either "return" or "r"
12 @Command("return|r", "Returns a specific exit code.")
13 struct ReturnCommand
14 {
15     @CommandPositionalArg(0, "code", "The code to return.")
16     int code;
17 
18     int onExecute()
19     {
20         return this.code;
21     }
22 
23     /++
24      + EXAMPLE USAGE:
25      +  test.exe return 0 -> status code 0
26      +  test.exe r -1     -> status code -1
27      + ++/
28 }