author | Stephen Talley <stephen.talley@oracle.com> |
Mon, 28 Mar 2011 10:53:34 -0400 | |
changeset 685 | 767674b0a2fb |
parent 591 | 7c5752b99fd6 |
permissions | -rw-r--r-- |
78
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
1 |
/* |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
2 |
* CDDL HEADER START |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
3 |
* |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
4 |
* The contents of this file are subject to the terms of the |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
5 |
* Common Development and Distribution License (the "License"). |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
6 |
* You may not use this file except in compliance with the License. |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
7 |
* |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
8 |
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
9 |
* or http://www.opensolaris.org/os/licensing. |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
10 |
* See the License for the specific language governing permissions |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
11 |
* and limitations under the License. |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
12 |
* |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
13 |
* When distributing Covered Code, include this CDDL HEADER in each |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
14 |
* file and include the License file at usr/src/OPENSOLARIS.LICENSE. |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
15 |
* If applicable, add the following below this CDDL HEADER, with the |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
16 |
* fields enclosed by brackets "[]" replaced with your own identifying |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
17 |
* information: Portions Copyright [yyyy] [name of copyright owner] |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
18 |
* |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
19 |
* CDDL HEADER END |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
20 |
*/ |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
21 |
|
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
22 |
/* |
685
767674b0a2fb
18094 s/StringBuffer/StringBuilder/g
Stephen Talley <stephen.talley@oracle.com>
parents:
591
diff
changeset
|
23 |
* Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. |
78
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
24 |
*/ |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
25 |
|
219
57841c113efe
6788 package names should share o.o.o.vp prefix
Stephen Talley <stephen.talley@sun.com>
parents:
165
diff
changeset
|
26 |
package org.opensolaris.os.vp.util.cli; |
78
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
27 |
|
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
28 |
import java.util.*; |
591
7c5752b99fd6
12473 panels should probably be run in a sandbox
Stephen Talley <stephen.talley@oracle.com>
parents:
219
diff
changeset
|
29 |
import org.opensolaris.os.vp.util.misc.TextUtil; |
7c5752b99fd6
12473 panels should probably be run in a sandbox
Stephen Talley <stephen.talley@oracle.com>
parents:
219
diff
changeset
|
30 |
import org.opensolaris.os.vp.util.misc.finder.Finder; |
78
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
31 |
|
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
32 |
public class UsageFormatter { |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
33 |
// |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
34 |
// Static data |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
35 |
// |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
36 |
|
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
37 |
public static final int _WIDTH = 65; |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
38 |
public static final int _INDENT = 4; |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
39 |
|
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
40 |
// |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
41 |
// Instance data |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
42 |
// |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
43 |
|
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
44 |
private String command; |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
45 |
private Option option; |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
46 |
private OptionFormatter formatter; |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
47 |
private String usageLabel = Finder.getString("command.usage.header"); |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
48 |
private int width = _WIDTH; |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
49 |
private int indent = _INDENT; |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
50 |
|
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
51 |
// |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
52 |
// Constructors |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
53 |
// |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
54 |
|
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
55 |
public UsageFormatter(String command, Option option, |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
56 |
OptionFormatter formatter) { |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
57 |
|
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
58 |
this.command = command; |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
59 |
this.option = option; |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
60 |
this.formatter = formatter; |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
61 |
} |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
62 |
|
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
63 |
// |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
64 |
// UsageFormatter methods |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
65 |
// |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
66 |
|
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
67 |
public String getCommand() { |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
68 |
return command; |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
69 |
} |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
70 |
|
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
71 |
public Option getOption() { |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
72 |
return option; |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
73 |
} |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
74 |
|
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
75 |
public OptionFormatter getOptionFormatter() { |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
76 |
return formatter; |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
77 |
} |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
78 |
|
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
79 |
public void setUsageLabel(String usageLabel) { |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
80 |
this.usageLabel = usageLabel; |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
81 |
} |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
82 |
|
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
83 |
public String getUsageLabel() { |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
84 |
return usageLabel; |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
85 |
} |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
86 |
|
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
87 |
public void setWidth(int width) { |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
88 |
this.width = width; |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
89 |
} |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
90 |
|
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
91 |
public int getWidth() { |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
92 |
return width; |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
93 |
} |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
94 |
|
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
95 |
public void setIndent(int indent) { |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
96 |
this.indent = indent; |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
97 |
} |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
98 |
|
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
99 |
public int getIndent() { |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
100 |
return indent; |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
101 |
} |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
102 |
|
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
103 |
public String getUsage() { |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
104 |
Option option = getOption(); |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
105 |
List<Option> options; |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
106 |
if (option instanceof OptionGroup) { |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
107 |
options = ((OptionGroup)option).getOptions(); |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
108 |
} else { |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
109 |
options = new ArrayList<Option>(); |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
110 |
options.add(option); |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
111 |
} |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
112 |
|
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
113 |
String usageLabel = getUsageLabel(); |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
114 |
String whitespace = usageLabel.replaceAll("\\S", " "); |
165
f2763cdf36b4
5076 undocumented command-line options should be supported
Stephen Talley <stephen.talley@sun.com>
parents:
78
diff
changeset
|
115 |
String indent1 = usageLabel; |
78
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
116 |
String indent2 = whitespace + |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
117 |
String.format("%" + getIndent() + "s", ""); |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
118 |
int width = getWidth(); |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
119 |
|
685
767674b0a2fb
18094 s/StringBuffer/StringBuilder/g
Stephen Talley <stephen.talley@oracle.com>
parents:
591
diff
changeset
|
120 |
StringBuilder buffer = new StringBuilder(); |
78
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
121 |
for (int i = 0, n = options.size(); i < n; i++) { |
165
f2763cdf36b4
5076 undocumented command-line options should be supported
Stephen Talley <stephen.talley@sun.com>
parents:
78
diff
changeset
|
122 |
Option o = options.get(i); |
f2763cdf36b4
5076 undocumented command-line options should be supported
Stephen Talley <stephen.talley@sun.com>
parents:
78
diff
changeset
|
123 |
if (o.isDocumented()) { |
f2763cdf36b4
5076 undocumented command-line options should be supported
Stephen Talley <stephen.talley@sun.com>
parents:
78
diff
changeset
|
124 |
String synopsis = command + " " + |
f2763cdf36b4
5076 undocumented command-line options should be supported
Stephen Talley <stephen.talley@sun.com>
parents:
78
diff
changeset
|
125 |
formatter.getFormatted(o, false); |
78
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
126 |
|
165
f2763cdf36b4
5076 undocumented command-line options should be supported
Stephen Talley <stephen.talley@sun.com>
parents:
78
diff
changeset
|
127 |
buffer.append(TextUtil.format( |
f2763cdf36b4
5076 undocumented command-line options should be supported
Stephen Talley <stephen.talley@sun.com>
parents:
78
diff
changeset
|
128 |
synopsis, width, indent1, indent2, false)); |
78
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
129 |
|
165
f2763cdf36b4
5076 undocumented command-line options should be supported
Stephen Talley <stephen.talley@sun.com>
parents:
78
diff
changeset
|
130 |
if (indent1 == usageLabel) { |
f2763cdf36b4
5076 undocumented command-line options should be supported
Stephen Talley <stephen.talley@sun.com>
parents:
78
diff
changeset
|
131 |
indent1 = "\n" + whitespace; |
f2763cdf36b4
5076 undocumented command-line options should be supported
Stephen Talley <stephen.talley@sun.com>
parents:
78
diff
changeset
|
132 |
} |
78
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
133 |
} |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
134 |
} |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
135 |
|
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
136 |
return buffer.toString(); |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
137 |
} |
6336fcea8db0
2521 Formalize CLI option parsing and document CLI syntax
Stephen Talley <stephen.talley@sun.com>
parents:
diff
changeset
|
138 |
} |