name.kevinlocke.ultragetopt
Class DarwinGetoptErrorFormatter

java.lang.Object
  extended by name.kevinlocke.ultragetopt.DarwinGetoptErrorFormatter
All Implemented Interfaces:
GetoptErrorFormatter

public class DarwinGetoptErrorFormatter
extends java.lang.Object
implements GetoptErrorFormatter

Error formatter designed to mimic the output of getopt on a Darwin (Mac OS) system.

Author:
Kevin Locke <kwl7@cornell.edu>

Constructor Summary
DarwinGetoptErrorFormatter(java.lang.String programname)
          Create a new instance of the formatter for Darwin-like Getopt errors.
 
Method Summary
 java.lang.String ambiguousOption(java.lang.String option, java.lang.String leaders)
          Formats an error message to indicate that the given option could not be unambiguously interpreted.
 java.lang.String missingRequiredArgument(char option, java.lang.String leaders)
          Formats an error message to indicate that the given option requires an argument and that none was found.
 java.lang.String missingRequiredArgument(java.lang.String option, java.lang.String leaders)
          Formats an error message to indicate that the given option requires an argument and that none was found.
 java.lang.String noArgumentAllowed(char option, java.lang.String leaders)
          Formats an error message to indicate that the given option does not accept any arguments.
 java.lang.String noArgumentAllowed(java.lang.String option, java.lang.String leaders)
          Formats an error message to indicate that the given option does not accept any arguments.
 java.lang.String unrecognizedOption(char option, java.lang.String leaders)
          Formats an error message to indicate that the given option was not recognized.
 java.lang.String unrecognizedOption(java.lang.String option, java.lang.String leaders)
          Formats an error message to indicate that the given option was not recognized.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DarwinGetoptErrorFormatter

public DarwinGetoptErrorFormatter(java.lang.String programname)
Create a new instance of the formatter for Darwin-like Getopt errors.

Parameters:
programname - The name of the program for printing to messages
Method Detail

ambiguousOption

public java.lang.String ambiguousOption(java.lang.String option,
                                        java.lang.String leaders)
Description copied from interface: GetoptErrorFormatter
Formats an error message to indicate that the given option could not be unambiguously interpreted.

Specified by:
ambiguousOption in interface GetoptErrorFormatter
Parameters:
option - The option which was ambiguous
leaders - The leader characters of the option (e.g. "--")
Returns:
A string suitable for printing to the user to indicate this error has occurred

missingRequiredArgument

public java.lang.String missingRequiredArgument(java.lang.String option,
                                                java.lang.String leaders)
Description copied from interface: GetoptErrorFormatter
Formats an error message to indicate that the given option requires an argument and that none was found.

Specified by:
missingRequiredArgument in interface GetoptErrorFormatter
Parameters:
option - The option which does is missing an argument
leaders - The leader characters of the option (e.g. "--")
Returns:
A string suitable for printing to the user to indicate this error has occurred

missingRequiredArgument

public java.lang.String missingRequiredArgument(char option,
                                                java.lang.String leaders)
Description copied from interface: GetoptErrorFormatter
Formats an error message to indicate that the given option requires an argument and that none was found.

Specified by:
missingRequiredArgument in interface GetoptErrorFormatter
Parameters:
option - The option which does is missing an argument
leaders - The leader characters of the option (e.g. "--")
Returns:
A string suitable for printing to the user to indicate this error has occurred

noArgumentAllowed

public java.lang.String noArgumentAllowed(java.lang.String option,
                                          java.lang.String leaders)
Description copied from interface: GetoptErrorFormatter
Formats an error message to indicate that the given option does not accept any arguments.

Specified by:
noArgumentAllowed in interface GetoptErrorFormatter
Parameters:
option - The option which does not take arguments
leaders - The leader characters of the option (e.g. "--")
Returns:
A string suitable for printing to the user to indicate this error has occurred

noArgumentAllowed

public java.lang.String noArgumentAllowed(char option,
                                          java.lang.String leaders)
Description copied from interface: GetoptErrorFormatter
Formats an error message to indicate that the given option does not accept any arguments.

Specified by:
noArgumentAllowed in interface GetoptErrorFormatter
Parameters:
option - The option which does not take arguments
leaders - The leader characters of the option (e.g. "--")
Returns:
A string suitable for printing to the user to indicate this error has occurred

unrecognizedOption

public java.lang.String unrecognizedOption(java.lang.String option,
                                           java.lang.String leaders)
Description copied from interface: GetoptErrorFormatter
Formats an error message to indicate that the given option was not recognized.

Specified by:
unrecognizedOption in interface GetoptErrorFormatter
Parameters:
option - The option which was not recognized
leaders - The leader characters of the option (e.g. "--")
Returns:
A string suitable for printing to the user to indicate this error has occurred

unrecognizedOption

public java.lang.String unrecognizedOption(char option,
                                           java.lang.String leaders)
Description copied from interface: GetoptErrorFormatter
Formats an error message to indicate that the given option was not recognized.

Specified by:
unrecognizedOption in interface GetoptErrorFormatter
Parameters:
option - The option which was not recognized
leaders - The leader characters of the option (e.g. "--")
Returns:
A string suitable for printing to the user to indicate this error has occurred