Argument

When you need to allow for command-line options in your application, you need Argument.
As a user of a Linux system or a command-line Windows system you are likely to have used programs that require some parameters on the command line.

Windows:  dir /B
Linux:  ls -l *

And more complex ones that extend beyond what you would normally expect on command-lines. This shows the use of an embedded Argument parser (--keys).

funnel myFile.txt --keys (String --length 10)(Integer --offset 10, --length 4)

Argument is a command-line parameter processing plugin for all of your Java applications.

It takes two steps in your code to use Argument: describe the command-line requirements to Argument, and then ask Argument to parse the command-line.

Read this first – it will help you to understand how to interact with Argument from the perspective of the command-line interface.

There are four essential parts of working with Argument:

  1. Creating the Argument Instance
  2. Compiling your application’s parser
  3. Parsing the command line
  4. Retrieval of Values or Injection of Values (--variable --class --factoryMethod --factoryArgName)

Most often this can be done in just a few lines of code.

This is a brief tutorial to get you acquainted with the processes.