Examples of NumberOption


Examples of au.com.cahaya.asas.util.cli.NumberOption

  public static void main (String[] args)
  {
    CommandLineParser parser = new GnuParser ();
    Options options = new Options ();
    options.addOption (new HelpOption ());
    NumberOption numberOption = new NumberOption ("Specify the number of passwords to generate");
    options.addOption (numberOption)
    try {
      // parse the command line arguments
      CommandLine line = parser.parse (options, args);

      if (line.hasOption (HelpOption.cValue)) {
        HelpFormatter hf = new HelpFormatter ();
        hf.printHelp (PasswordGenerator.class.toString (), options);
      }
      else {
        int number = numberOption.parse ();
        System.out.println ("Generating " + number + " passwords.");
        for (int i = 0; i < number; i++) {
          System.out.println (PasswordGenerator.generate (9));
        }
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.