2 File is HelpInfo class which is used to output the usage info.
4 Copyright (c) 2006, Intel Corporation
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14 package org
.tianocore
.context
;
16 import java
.util
.LinkedList
;
18 public class HelpInfo
{
22 * output the tools usage guide
23 * @param no input parameter
24 * @return no return value
26 public static void outputUsageInfo() {
27 System
.out
.printf("\n%s", UsageInfoString
);
28 System
.out
.printf("\n%s", DetailOfOptionString
);
30 for (int i
= 0; i
< 6; i
++) {
31 outputSubUsageInfo(UsageString
[i
], UsageStringInfo
[i
]);
34 System
.out
.printf("\n%s", ExampleString
);
38 * output the usage info which bases on cmd option
39 * @param String str1 : the cmd option
40 * String str2 : the detail of cmd option
41 * @return no return value
43 private static void outputSubUsageInfo(String str1
, String str2
) {
46 System
.out
.printf("\n%4s %-30s %s", "", str1
, List
.get(0));
47 for (int i
=1; i
<List
.size(); i
++){
48 System
.out
.printf("\n%4s %-30s %s", "", "", List
.get(i
));
54 * according to the output width, split the detail info
55 * @param String str :the detail info
56 * @return no return value
58 private static void splitString(String str
) {
59 int strlength
= str
.length();
60 if (strlength
> MaxSrtingLength
) {
61 String
[] tokens
= str
.split("[ ]", 0);
62 String tempstr
= null;
66 for (int i
= 0; i
< tokens
.length
; i
++) {
67 if ((templength
= end
+ tokens
[i
].length() + 1) < (MaxSrtingLength
+ start
)) {
70 tempstr
= str
.substring(start
, end
);
76 tempstr
= str
.substring(start
, end
- 1);
84 private static LinkedList
<String
> List
= new LinkedList
<String
>();
86 private static final int MaxSrtingLength
= 40;
88 private static final String UsageInfoString
= "Usage: ContextTool [-option1] [args] [-option2] [args] ...";
90 private static final String DetailOfOptionString
= "Where options include:";
92 private static final String ExampleString
= "Example: ContextTool -a IA32 IA64 EBC -c Tools/Conf/tools_def.txt -t DEBUG";
94 private static final String HString
= "-h";
96 private static final String HStringInfo
= "print this help message";
98 private static final String AString
= "-a <list of Arch>";
100 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.";
102 private static final String CString
= "-c <tool_definition_file.txt>";
104 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\"";
106 private static final String NString
= "-n <list of TagNames>";
108 private static final String NStringInfo
= "Specify the TagName, such as GCC, MSFT, which are defined in the \"tool_definition_file.txt\"";
110 private static final String PString
= "-p <*.fpd>";
112 private static final String PStringInfo
= "Specify the WORKSPACE relative Path and Filename of platform FPD file that will be used for the build.";
114 private static final String TString
= "-t <list of Build Targets>";
116 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.";
118 private static final String
[] UsageString
= { HString
, AString
, CString
,
119 NString
, PString
, TString
};
121 private static final String
[] UsageStringInfo
= { HStringInfo
, AStringInfo
,
122 CStringInfo
, NStringInfo
, PStringInfo
, TStringInfo
};