Created
February 2, 2009 22:41
-
-
Save imbriaco/57143 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void main (String args[]) | |
{ | |
//Build the command line options | |
Options options = addCommandLineOptions (); | |
if (args.length <= 0) | |
printHelp (options); | |
CommandLineParser parser = new GnuParser(); | |
try | |
{ | |
// parse the command line arguments | |
CommandLine line = parser.parse( options, args ); | |
if (line.hasOption("help")) | |
printHelp (options); | |
if (line.hasOption("containersOnly")) | |
{ | |
if (line.hasOption("H")) | |
printContainers (true); | |
else | |
printContainers (false); | |
} | |
else if (line.hasOption("all")) | |
{ | |
if (line.hasOption("H")) | |
printContainersAll (true); | |
else | |
printContainersAll (false); | |
}//if (line.hasOption("all")) | |
else if (line.hasOption("container")) | |
{ | |
String containerName = line.getOptionValue("container"); | |
if (StringUtils.isNotBlank(containerName)) | |
{ | |
if (line.hasOption("H")) | |
printContainer (containerName, true); | |
else | |
printContainer (containerName, false); | |
} | |
}//if (line.hasOption("container")) | |
else if (line.hasOption("H")) | |
{ | |
System.out.println ("This option needs to be used in conjunction with another option that lists objects or container."); | |
} | |
} | |
catch( ParseException err ) | |
{ | |
System.err.println( "Please see the logs for more details. Error Message: "+err.getMessage() ); | |
err.printStackTrace(System.err); | |
}//catch( ParseException err ) | |
catch (FilesAuthorizationException err) | |
{ | |
System.err.println( "Please see the logs for more details. Error Message: "+err.getMessage() ); | |
}//catch (FilesAuthorizationException err) | |
catch ( IOException err) | |
{ | |
System.err.println( "Please see the logs for more details. Error Message: "+err.getMessage() ); | |
}//catch ( IOException err) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment