1 package org
.tianocore
.context
;
3 public class HelpInfo
{
7 * output the tools usage guide
8 * @param no input parameter
9 * @return no return value
11 public static void outputUsageInfo() {
12 System
.out
.printf("\n%s", UsageInfoString
);
13 System
.out
.printf("\n%s", DetailOfOptionString
);
15 for (int i
= 0; i
< 6; i
++) {
16 outputSubUsageInfo(UsageString
[i
], UsageStringInfo
[i
]);
21 * output the usage info which bases on cmd option
22 * @param String str1 : the cmd option
23 * String str2 : the detail of cmd option
24 * @return no return value
26 private static void outputSubUsageInfo(String str1
, String str2
) {
29 System
.out
.printf("\n%4s %-30s %s", "", str1
, substr
[0]);
30 for (int i
= 1; i
< substrnum
; i
++) {
31 if (substr
[i
] != null)
32 System
.out
.printf("\n%4s %-30s %s", "", "", substr
[i
]);
36 System
.out
.printf("\n%4s %-30s %s", "", str1
, str2
);
41 * according to the output width, split the detail info
42 * @param String str :the detail info
43 * @return no return value
45 private static void splitString(String str
) {
46 int strlength
= str
.length();
47 if (strlength
> MaxSrtingLength
) {
49 //we should modify the array to list, for it is strange to + 2
50 substrnum
= strlength
/ MaxSrtingLength
+ 2;
51 String
[] tokens
= str
.split("[ ]", 0);
52 substr
= new String
[substrnum
];
57 for (int i
= 0; i
< tokens
.length
; i
++) {
58 if ((templength
= end
+ tokens
[i
].length() + 1) < (MaxSrtingLength
+ start
)) {
61 substr
[j
++] = str
.substring(start
, end
);
66 substr
[j
] = str
.substring(start
, end
- 1);
70 private static String
[] substr
= null;
72 private static int substrnum
= 0;
74 private static final int MaxSrtingLength
= 40;
76 private static final String UsageInfoString
= "Usage: context [-option1] [args] [-option2] [args] ...";
78 private static final String DetailOfOptionString
= "Where options include:";
80 private static final String HString
= "-h";
82 private static final String HStringInfo
= "print this help message";
84 private static final String AString
= "-a <list of Arch>";
86 private static final String AStringInfo
= "what kind of architechure is the binary target, such as IA32, IA64, X64, EBC, or ARM. Multiple values can be specified on a single line, using space to separate the values.";
88 private static final String CString
= "-c <tool_definition_file.txt>";
90 private static final String CStringInfo
= "Assign a txt file, which specify the tools to use for the build and must be located in the path: WORKSPACE/Tools/Conf/. If no file is specified, the default filename is \"tools_def.txt\"";
92 private static final String NString
= "-n <list of TagNames>";
94 private static final String NStringInfo
= "Specify the TagName, such as GCC, MSFT, which are defined in the \"tool_definition_file.txt\"";
96 private static final String PString
= "-p <*.fpd>";
98 private static final String PStringInfo
= "Specify the WORKSPACE relative Path and Filename of platform FPD file that will be used for the build.";
100 private static final String TString
= "-t <list of Build Targets>";
102 private static final String TStringInfo
= "What kind of the version is the binary target, such as DEBUG, RELEASE. Multiple values can be specified on a single line, using space to separate the values.";
104 private static final String
[] UsageString
= { HString
, AString
, CString
,
105 NString
, PString
, TString
};
107 private static final String
[] UsageStringInfo
= { HStringInfo
, AStringInfo
,
108 CStringInfo
, NStringInfo
, PStringInfo
, TStringInfo
};