package examples.dustin.commandline.jbock;

import static java.lang.System.out;

import net.jbock.CommandLineArguments;
import net.jbock.Description;
import net.jbock.LongName;
import net.jbock.ShortName;

import java.util.Optional;

/**
 * Demonstrates use of jbock to process command-line
 * arguments in a Java application.
 */
public class Main
{

   @CommandLineArguments
   abstract static class Arguments
   {

      @ShortName('v') @LongName("verbose") @Description("Verbosity enabled?")
      abstract boolean verbose();

      @ShortName('f') @LongName("file") @Description("File name and path")
      abstract String file();
   }

   public static void main(String[] arguments)
   {
      Main_Arguments_Parser.parse(arguments, System.out)
        .ifPresentOrElse(args ->
              System.out.println("The file '" + args.file() + "' was provided and verbosity is set to '" + args.verbose() + "'."),
              () -> System.exit(1));
   }
}

@@ -41,45 +41,8 @@
 k;%0A%0A
-import static java.lang.System.out;%0A%0A
 impo
@@ -166,36 +166,8 @@
 e;%0A%0A
-import java.util.Optional;%0A%0A
 /**%0A
@@ -627,16 +627,33 @@
  %7B%0A     
+ Arguments args =
  Main_Ar
@@ -671,78 +671,41 @@
 ser.
-parse(arguments, System.out)%0A        .ifPresentOrElse(args -%3E%0A        
+create().parseOrExit(arguments);%0A
     
@@ -827,45 +827,8 @@
 %22),%0A
-              () -%3E System.exit(1));%0A
    %7D

update to jbock 2.4.1