1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | package Torello.Java.Build; import Torello.Java.StringParse; import Torello.Java.ReadOnly.ReadOnlyList; import static Torello.Java.C.BYELLOW; import static Torello.Java.C.RESET; import Apache.CLI.Option; import Apache.CLI.Options; // 1) Generates the instances of the Apache-CLI class "Option" for all Auxiliary-Menu-Options. // 2) Then it inserts those Option's into an instance of Apache-CLI class "Options" // 3) Finally, it builds a String out of those Auxiliary-Options for printing to the Menu. // // NOTE: This class has but one method. That method returns the Sub-Menu Text for these // Auxiliary-Options as a java.lang.String. The actual Apache-CLI "Option" and "Options" // are handled and inserted properly within this method. They do not need to be returned // to the caller of this method. class GenerateAuxiliaryOpts { static String generate(Options options) { final Option noQuickBuild = Option .builder ("NQB") .required (false) .desc ("Prevent a Quick Build during Partial-Build's") .longOpt ("noQuickBuild") .hasArg (false) .build(); final Option putJarInCP = Option .builder ("JCP") .required (false) .desc ("Include the '.jar' File in the Class-Path") .longOpt ("putJarInCP") .hasArg (false) .build(); final Option skipRemoveGCSFiles = Option .builder ("SRG") .required (false) .desc ("Skip the removal-step of all Java-Doc GCS Files, when synchronizing.") .longOpt ("skipRemoveGCSFiles") .hasArg (false) .build(); final Option overrideToggleXlintSwitch = Option .builder ("TXL") .required (false) .desc ("Toggle whatever the default setting is for applying -Xlint:all") .longOpt ("toggleDefaultXlint") .hasArg (false) .build(); final Option overrideToggleXdiagsSwitch = Option .builder ("TXD") .required (false) .desc ("Toggle whatever the default setting is for applying -Xdiags:verbose") .longOpt ("toggleDefaultXdiags") .hasArg (false) .build(); final Option includeEarlyDevPkgsSwitch = Option .builder ("IEDP") .required (false) .desc ("Include Packages still Under Early Development in the Build") .longOpt ("includeEarlyDev") .hasArg (false) .build(); final Option jarFileOnly = Option .builder ("JFO") .required (false) .desc ("Only generate a '.jar' File during the Stage-4 Build-Step") .longOpt ("jarFileOnly") .hasArg (false) .build(); final Option wipeClassFilesFirst = Option .builder ("WCFF") .required (false) .desc ("In Stage-1, Wipe all '.class' Files before executing javac") .longOpt ("wipeClassFilesFirst") .hasArg (false) .build(); ReadOnlyList<Option> auxOpts = ReadOnlyList.of( noQuickBuild, putJarInCP, skipRemoveGCSFiles, overrideToggleXlintSwitch, overrideToggleXdiagsSwitch, includeEarlyDevPkgsSwitch, jarFileOnly, wipeClassFilesFirst ); final StringBuilder sb = new StringBuilder(); sb.append("\n\n\t" + BYELLOW + "Auxiliary Options:" + RESET); int max = 0; for (Option o : auxOpts) { final String optStr = o.getOpt() + ',' + "--" + o.getLongOpt(); if (optStr.length() > max) max = optStr.length(); } max += 2; for (Option o : auxOpts) { // This "options" instance is passed as a parameter into this method! options.addOption(o); final String optStr = o.getOpt() + ',' + "--" + o.getLongOpt(); sb.append( "\n\t\t-" + optStr + StringParse.nChars(' ', max - optStr.length()) + o.getDescription() ); } return sb.toString(); } } |