]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - Tools/Source/ContextTool/org/tianocore/context/HelpInfo.java
To fix EDKT284.
[mirror_edk2.git] / Tools / Source / ContextTool / org / tianocore / context / HelpInfo.java
... / ...
CommitLineData
1/** @file\r
2 File is HelpInfo class which is used to output the usage info. \r
3 \r
4Copyright (c) 2006, Intel Corporation\r
5All rights reserved. This program and the accompanying materials\r
6are licensed and made available under the terms and conditions of the BSD License\r
7which accompanies this distribution. The full text of the license may be found at\r
8http://opensource.org/licenses/bsd-license.php\r
9 \r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12**/\r
13\r
14package org.tianocore.context;\r
15\r
16import java.util.LinkedList;\r
17\r
18public class HelpInfo {\r
19\r
20 \r
21 /** \r
22 * output the tools usage guide\r
23 * @param no input parameter\r
24 * @return no return value\r
25 **/\r
26 public static void outputUsageInfo() {\r
27 System.out.printf("\n%s", DescripationString);\r
28 System.out.printf("\n%s", UsageInfoString);\r
29 System.out.printf("\n%s", DetailOfOptionString);\r
30\r
31 for (int i = 0; i < settingnum; i++) {\r
32 outputSubUsageInfo(UsageString[i], UsageStringInfo[i]);\r
33 }\r
34 \r
35 System.out.printf("\n%s", ExampleString);\r
36 }\r
37\r
38 /** \r
39 * output the usage info which bases on cmd option \r
40 * @param String str1 : the cmd option\r
41 * String str2 : the detail of cmd option\r
42 * @return no return value\r
43 **/\r
44 private static void outputSubUsageInfo(String str1, String str2) {\r
45 \r
46 splitString(str2);\r
47 System.out.printf("\n%4s %-30s %s", "", str1, List.get(0));\r
48 for (int i=1; i<List.size(); i++){\r
49 System.out.printf("\n%4s %-30s %s", "", "", List.get(i));\r
50 }\r
51 List.clear();\r
52 }\r
53\r
54 /** \r
55 * according to the output width, split the detail info \r
56 * @param String str :the detail info\r
57 * @return no return value\r
58 **/\r
59 private static void splitString(String str) {\r
60 int strlength = str.length();\r
61 if (strlength > MaxSrtingLength) {\r
62 String[] tokens = str.split("[ ]", 0);\r
63 String tempstr = null;\r
64 int templength = 0;\r
65 int start = 0;\r
66 int end = 0;\r
67 for (int i = 0; i < tokens.length; i++) {\r
68 if ((templength = end + tokens[i].length() + 1) < (MaxSrtingLength + start)) {\r
69 end = templength;\r
70 } else {\r
71 tempstr = str.substring(start, end);\r
72 List.add(tempstr);\r
73 start = end;\r
74 i = i - 1;\r
75 }\r
76 }\r
77 tempstr = str.substring(start, end - 1);\r
78 List.add(tempstr);\r
79 } else {\r
80 List.add(str);\r
81 }\r
82 }\r
83\r
84 \r
85 private static LinkedList<String> List = new LinkedList<String>();\r
86\r
87 private static final int MaxSrtingLength = 40;\r
88 \r
89 private static final int settingnum = 7;\r
90 \r
91 private static final String DescripationString = "The purpose of this tool is modifying the settings in target.txt";\r
92 \r
93 private static final String UsageInfoString = "Usage: ContextTool [-option1] [args] [-option2] [args] ...";\r
94\r
95 private static final String DetailOfOptionString = "Where options include:";\r
96 \r
97 private static final String ExampleString = "Example: ContextTool -a IA32 IA64 EBC -c Tools/Conf/tools_def.txt -t DEBUG -n GCC -p EdkNt32Pkg/Nt32.fpd -m 2\n";\r
98\r
99 private static final String HString = "-h";\r
100\r
101 private static final String HStringInfo = "print usage info";\r
102\r
103 private static final String AString = "-a <list of Arch>";\r
104\r
105 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.";\r
106\r
107 private static final String CString = "-c <tool_definition_file.txt>";\r
108\r
109 private static final String CStringInfo = "Assign a txt file with the relative path to WORKSPACE, 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\"";\r
110\r
111 private static final String NString = "-n <list of TagNames>";\r
112\r
113 private static final String NStringInfo = "Specify the TagName, such as GCC, MSFT, which are defined in the \"tool_definition_file.txt\"";\r
114\r
115 private static final String PString = "-p <*.fpd>";\r
116\r
117 private static final String PStringInfo = "Specify the WORKSPACE relative Path and Filename of platform FPD file that will be used for the build.";\r
118\r
119 private static final String TString = "-t <list of Build Targets>";\r
120\r
121 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.";\r
122\r
123 private static final String MString = "-m <num of Threads>";\r
124 \r
125 private static final String MStringInfo = "number should GE 0. 0 clears both MULTIPLE_THREAD and MAX_CONCURRENT_THREAD_NUMBER, others enable MULTIPLE_THREAD and set MAX_CONCURRENT_THREAD_NUMBER.";\r
126 \r
127 private static final String[] UsageString = { HString, AString, CString,\r
128 NString, PString, TString, MString };\r
129\r
130 private static final String[] UsageStringInfo = { HStringInfo, AStringInfo,\r
131 CStringInfo, NStringInfo, PStringInfo, TStringInfo, MStringInfo };\r
132}\r