de.unkrig.commons.text
Class CommandLineUtil

java.lang.Object
  extended by de.unkrig.commons.text.CommandLineUtil

public final class CommandLineUtil
extends java.lang.Object

Utility methods for processing command line arguments.


Method Summary
static java.lang.String[] expandSingleLetterOptions(java.lang.String[] args, int idx, java.lang.Object... mapping)
          Replaces 'combined' single-letter options (as in "ls -lart") with 'long' options (as "ls -long -all -reverse -time").
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

expandSingleLetterOptions

public static java.lang.String[] expandSingleLetterOptions(java.lang.String[] args,
                                                           int idx,
                                                           java.lang.Object... mapping)
Replaces 'combined' single-letter options (as in "ls -lart") with 'long' options (as "ls -long -all -reverse -time").

Parameters:
args - The command line arguments, e.g. "-foo", "-abc", "arg1", "arg2", "-bar"
idx - The index of the command line argument to expand, e.g. 1 (designating "-abc")
mapping - Triplets of Characters, Strings and Integers representing unexpanded option, expanded option and option argument count, e.g. 'a', "-alpha", 1, 'b', "-beta", 0, 'c', "-gamma", 1
Returns:
The expanded args, e.g. "-foo", "-alpha", "arg1", "-beta", "-gamma", "arg2", "-bar"