public class CommandLineAccess extends Object
| Constructor and Description |
|---|
CommandLineAccess() |
| Modifier and Type | Method and Description |
|---|---|
protected static String |
deriveDescription(IPropertyInfo propertyInfo) |
static File |
getCurrentProgram() |
static String |
getHelpMessageFor(Object obj)
Returns the help message derived from the given type
|
static List<String> |
getRawArgs() |
static void |
initialize(IType commandLineShell)
Initializes the static properties on the given type based on the command
line arguments.
|
static boolean |
initialize(Object obj,
boolean exitOnBadArgs)
Initializes the properties on the given object based on the command
line arguments.
|
static boolean |
isUseTerminalWidth() |
static void |
setCurrentProgram(File currentProgram) |
static void |
setExitEnabled(boolean exitEnabled) |
static void |
setRawArgs(List<String> args) |
static void |
setUseTerminalWidth(boolean b)
Set to true for CommandLineAccess to use the active terminals width when printing it's help message
|
static void |
showHelp(IType obj)
Shows a help message for the program arguments derived from the given type, sent
to stdout
|
static void |
showHelp(String programName,
Object obj)
Shows a help message for the program arguments derived from the given type, sent
to stdout
|
public static List<String> getRawArgs()
public static void setRawArgs(List<String> args)
args - the args to a Gosu programpublic static File getCurrentProgram()
public static void setCurrentProgram(File currentProgram)
currentProgram - - the currently executing programpublic static boolean isUseTerminalWidth()
public static void setUseTerminalWidth(boolean b)
public static void initialize(IType commandLineShell)
commandLineShell - the class to initialize from the passed in argumentspublic static boolean initialize(Object obj, boolean exitOnBadArgs)
obj - the class to initialize from the passed in argumentsexitOnBadArgs - if true is passed in and the arguments incorrectly map to the
given type, a help message will be printed and the JVM will exit with a -1 return value,
otherwise a false value will be returnedpublic static void showHelp(String programName, Object obj)
programName - the name of the programobj - either the type of the command line shell if static properties are used, or the instance if instance properties are usedpublic static void showHelp(IType obj)
obj - either the type of the command line shell if static properties are used, or the instance if instance properties are usedpublic static String getHelpMessageFor(Object obj)
obj - the object or type of the command line shellprotected static String deriveDescription(IPropertyInfo propertyInfo)
public static void setExitEnabled(boolean exitEnabled)
Copyright © 2015. All rights reserved.