Guest User

Untitled

a guest
Nov 4th, 2020
333
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
Add Comment
Please, Sign In to add comment