package examples.dustin.commandline.jbock;

import static java.lang.System.out;

import net.jbock.CommandLineArguments;
import net.jbock.Parameter;

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
   {

      /**
       * Verbosity enabled?
       */
      @Parameter(shortName = 'v', longName = "verbose")
      abstract boolean verbose();

      /**
       * File name and path
       */
      @Parameter(shortName = 'f', longName = "file")
      abstract String file();
   }

   public static void main(String[] arguments)
   {
      Arguments args = Main_Arguments_Parser.create().parseOrExit(arguments);
      System.out.println("The file '" + args.file() + "' was provided and verbosity is set to '" + args.verbose() + "'.");
   }
}

package examples.dustin.commandline.jbock;

import net.jbock.Command;
import net.jbock.Option;

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

   @Command
   abstract static class Arguments
   {

      /**
       * Verbosity enabled?
       */
      @Option(value = "verbose", mnemonic = 'v')
      abstract boolean verbose();

      /**
       * File name and path
       */
      @Option(value = "file", mnemonic = 'f')
      abstract String file();
   }

   public static void main(String[] arguments)
   {
      Arguments args = Main_Arguments_Parser.create().parseOrExit(arguments);
      System.out.println("The file '" + args.file() + "' was provided and verbosity is set to '" + args.verbose() + "'.");
   }
}

update jbock example