public boolean setOptions ( String [ ] options ) throws Exception { ArgumentParser parser ; Namespace ns ; parser = ArgumentParsers . newArgumentParser ( MinDeps . class . getName ( ) ) ; parser . addArgument ( "--java-home" ) . type ( Arguments . fileType ( ) . verifyExists ( ) . verifyIsDirectory ( ) ) . dest ( "javahome" ) . required ( true ) . help ( "The java home directory of the JDK that includes the jdeps binary, default is taken from JAVA_HOME environment variable." ) ; parser . addArgument ( "--class-path" ) . dest ( "classpath" ) . required ( true ) . help ( "The CLASSPATH to use for jdeps." ) ; parser . addArgument ( "--classes" ) . type ( Arguments . fileType ( ) . verifyExists ( ) . verifyIsFile ( ) . verifyCanRead ( ) ) . dest ( "classes" ) . required ( true ) . help ( "The file containing the classes to determine the dependencies for. Empty lines and lines starting with # get ignored." ) ; parser . addArgument ( "--additional" ) . type ( Arguments . fileType ( ) ) . setDefault ( new File ( "." ) ) . required ( false ) . dest ( "additional" ) . help ( "The file with additional class names to just include." ) ; parser . addArgument ( "--output" ) . type ( Arguments . fileType ( ) ) . setDefault ( new File ( "." ) ) . required ( false ) . dest ( "output" ) . help ( "The file for storing the determined class names in." ) ; parser . addArgument ( "package" ) . dest ( "packages" ) . required ( true ) . nargs ( "+" ) . help ( "The packages to keep, eg 'weka'." ) ; try { ns = parser . parseArgs ( options ) ; } catch ( ArgumentParserException e ) { parser . handleError ( e ) ; return false ; } setJavaHome ( ns . get ( "javahome" ) ) ; setClassPath ( ns . getString ( "classpath" ) ) ; setClassesFile ( ns . get ( "classes" ) ) ; setAdditionalFile ( ns . get ( "additional" ) ) ; setPackages ( ns . getList ( "packages" ) ) ; setOutputFile ( ns . get ( "output" ) ) ; return true ; }
Sets the commandline options .