]> git.proxmox.com Git - mirror_edk2.git/blame - Tools/Source/ContextTool/org/tianocore/context/HelpInfo.java
Adding the *NIX equivalent to fw.bat
[mirror_edk2.git] / Tools / Source / ContextTool / org / tianocore / context / HelpInfo.java
CommitLineData
987912ad 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
c74c7a43 14package org.tianocore.context;\r
15\r
67ce7c51 16import java.util.LinkedList;\r
17\r
c74c7a43 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", UsageInfoString);\r
28 System.out.printf("\n%s", DetailOfOptionString);\r
29\r
30 for (int i = 0; i < 6; i++) {\r
31 outputSubUsageInfo(UsageString[i], UsageStringInfo[i]);\r
32 }\r
91f560c1 33 \r
34 System.out.printf("\n%s", ExampleString);\r
c74c7a43 35 }\r
36\r
37 /** \r
38 * output the usage info which bases on cmd option \r
39 * @param String str1 : the cmd option\r
40 * String str2 : the detail of cmd option\r
41 * @return no return value\r
42 **/\r
43 private static void outputSubUsageInfo(String str1, String str2) {\r
67ce7c51 44 \r
c74c7a43 45 splitString(str2);\r
67ce7c51 46 System.out.printf("\n%4s %-30s %s", "", str1, List.get(0));\r
47 for (int i=1; i<List.size(); i++){\r
48 System.out.printf("\n%4s %-30s %s", "", "", List.get(i));\r
c74c7a43 49 }\r
67ce7c51 50 List.clear();\r
c74c7a43 51 }\r
52\r
53 /** \r
54 * according to the output width, split the detail info \r
55 * @param String str :the detail info\r
56 * @return no return value\r
57 **/\r
58 private static void splitString(String str) {\r
59 int strlength = str.length();\r
60 if (strlength > MaxSrtingLength) {\r
c74c7a43 61 String[] tokens = str.split("[ ]", 0);\r
67ce7c51 62 String tempstr = null;\r
c74c7a43 63 int templength = 0;\r
c74c7a43 64 int start = 0;\r
65 int end = 0;\r
66 for (int i = 0; i < tokens.length; i++) {\r
67 if ((templength = end + tokens[i].length() + 1) < (MaxSrtingLength + start)) {\r
68 end = templength;\r
69 } else {\r
67ce7c51 70 tempstr = str.substring(start, end);\r
71 List.add(tempstr);\r
c74c7a43 72 start = end;\r
73 i = i - 1;\r
74 }\r
75 }\r
67ce7c51 76 tempstr = str.substring(start, end - 1);\r
77 List.add(tempstr);\r
78 } else {\r
79 List.add(str);\r
c74c7a43 80 }\r
81 }\r
82\r
67ce7c51 83 \r
84 private static LinkedList<String> List = new LinkedList<String>();\r
c74c7a43 85\r
86 private static final int MaxSrtingLength = 40;\r
87\r
91f560c1 88 private static final String UsageInfoString = "Usage: ContextTool [-option1] [args] [-option2] [args] ...";\r
c74c7a43 89\r
90 private static final String DetailOfOptionString = "Where options include:";\r
91f560c1 91 \r
92 private static final String ExampleString = "Example: ContextTool -a IA32 IA64 EBC -c Tools/Conf/tools_def.txt -t DEBUG";\r
c74c7a43 93\r
94 private static final String HString = "-h";\r
95\r
96 private static final String HStringInfo = "print this help message";\r
97\r
98 private static final String AString = "-a <list of Arch>";\r
99\r
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.";\r
101\r
102 private static final String CString = "-c <tool_definition_file.txt>";\r
103\r
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\"";\r
105\r
106 private static final String NString = "-n <list of TagNames>";\r
107\r
108 private static final String NStringInfo = "Specify the TagName, such as GCC, MSFT, which are defined in the \"tool_definition_file.txt\"";\r
109\r
110 private static final String PString = "-p <*.fpd>";\r
111\r
112 private static final String PStringInfo = "Specify the WORKSPACE relative Path and Filename of platform FPD file that will be used for the build.";\r
113\r
114 private static final String TString = "-t <list of Build Targets>";\r
115\r
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.";\r
117\r
118 private static final String[] UsageString = { HString, AString, CString,\r
119 NString, PString, TString };\r
120\r
121 private static final String[] UsageStringInfo = { HStringInfo, AStringInfo,\r
122 CStringInfo, NStringInfo, PStringInfo, TStringInfo };\r
123}\r