Skip to content

Commit 9f868a9

Browse files
committed
style api
1 parent 3eae569 commit 9f868a9

File tree

94 files changed

+9250
-439
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+9250
-439
lines changed

build.config

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
project=gshell
44

55
function command_rebuild {
6+
rm -rf target
67
mvn clean install $*
78
unzip -d target gshell-assembly/target/gshell-*-bin.zip
89
}

gshell-api/src/main/java/com/planet57/gshell/branding/BrandingSupport.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,7 @@ public String getGoodbyeMessage() {
108108

109109
@Override
110110
public String getPrompt() {
111-
// FIXME: may need to adjust ansi-renderer syntax or pre-render before expanding to avoid needing escapes
112-
return String.format("\\@\\|bold %s\\|\\@> ", getProgramName());
111+
return String.format("\\@\\{bold %s\\}> ", getProgramName());
113112
}
114113

115114
@Override

gshell-api/src/main/java/com/planet57/gshell/help/AliasHelpPage.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ public class AliasHelpPage
3434
private interface Messages
3535
extends MessageBundle
3636
{
37-
@DefaultMessage("Alias to: @|bold %s|@")
37+
@DefaultMessage("Alias to: @{bold %s}")
3838
String description(String target);
3939

40-
@DefaultMessage("The @|bold %s|@ command is an alias to: @|bold %s|@")
40+
@DefaultMessage("The @{bold %s} command is an alias to: @{bold %s}")
4141
String content(String name, String target);
4242
}
4343

gshell-api/src/main/java/com/planet57/gshell/help/CommandHelpPage.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public String getDescription() {
129129
}
130130

131131
private void printHeader(final PrintBuffer buff, final String name) {
132-
buff.format("@|bold %s|@%n", name);
132+
buff.format("@{bold %s}%n", name);
133133
buff.println();
134134
}
135135

@@ -166,7 +166,7 @@ public String getPreferences() {
166166
printHeader(buff, CommandHelpPage.messages.preferences());
167167

168168
for (PreferenceDescriptor pd : pp.getDescriptors()) {
169-
String text = String.format(" %s @|bold %s|@ (%s)",
169+
String text = String.format(" %s @{bold %s} (%s)",
170170
pd.getPreferences().absolutePath(), pd.getId(), pd.getSetter().getType().getSimpleName());
171171
buff.println(text);
172172
}
@@ -209,7 +209,7 @@ public void render(final Shell shell, final PrintWriter out) throws Exception {
209209
final Terminal terminal = shell.getTerminal();
210210
final Variables variables = shell.getVariables();
211211

212-
Interpolator interp = new StringSearchInterpolator("@{", "}");
212+
Interpolator interp = new StringSearchInterpolator("%{", "}");
213213
interp.addValueSource(new PrefixedObjectValueSource("command.", new Helper(branding, terminal.getWidth())));
214214
interp.addValueSource(new PrefixedObjectValueSource("branding.", branding));
215215
interp.addValueSource(new AbstractValueSource(false)

gshell-api/src/main/java/com/planet57/gshell/help/GroupHelpPage.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ public class GroupHelpPage
3636
private interface Messages
3737
extends MessageBundle
3838
{
39-
@DefaultMessage("Command group: @|bold %s|@")
39+
@DefaultMessage("Command group: @{bold %s}")
4040
String description(String name);
4141

42-
@DefaultMessage("Help pages in group @|bold %s|@:")
42+
@DefaultMessage("Help pages in group @{bold %s}:")
4343
String header(String name);
4444
}
4545

gshell-api/src/main/java/com/planet57/gshell/help/HelpPageUtil.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public static void renderIndex(final PrintWriter out, final Collection<? extends
5050

5151
for (HelpPage page : pages) {
5252
String formattedName = String.format(nameFormat, page.getName());
53-
out.format(" @|bold %s|@", formattedName);
53+
out.format(" @{bold %s}", formattedName);
5454

5555
String description = page.getDescription();
5656
if (description != null) {

gshell-api/src/main/java/com/planet57/gshell/help/MetaHelpPage.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public void render(final Shell shell, final PrintWriter out) throws Exception {
6464
final Branding branding = shell.getBranding();
6565
final Variables variables = shell.getVariables();
6666

67-
Interpolator interp = new StringSearchInterpolator("@{", "}");
67+
Interpolator interp = new StringSearchInterpolator("%{", "}");
6868
interp.addValueSource(new PrefixedObjectValueSource("branding.", branding));
6969
interp.addValueSource(new AbstractValueSource(false)
7070
{

gshell-api/src/main/java/com/planet57/gshell/shell/ShellErrorHandler.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,16 @@ private void displayError(final PrintWriter out, final Throwable error, final bo
6262

6363
Throwable cause = error;
6464

65-
out.format("@|bold,red %s|@", cause.getClass().getName());
65+
out.format("@{bold,fg:!red %s}", cause.getClass().getName());
6666
if (cause.getMessage() != null) {
67-
out.format(": @|bold,red %s|@", cause.getMessage());
67+
out.format(": @{bold,fg:red %s}", cause.getMessage());
6868
}
6969
out.println();
7070

7171
if (verbose) {
7272
while (cause != null) {
7373
for (StackTraceElement e : cause.getStackTrace()) {
74-
out.format(" @|bold %s|@ %s.%s (@|bold %s|@)%n",
74+
out.format(" @{bold %s} %s.%s (@{bold %s})%n",
7575
messages.at(),
7676
e.getClassName(),
7777
e.getMethodName(),
@@ -81,7 +81,7 @@ private void displayError(final PrintWriter out, final Throwable error, final bo
8181

8282
cause = cause.getCause();
8383
if (cause != null) {
84-
out.format("@|bold %s|@ %s%n", messages.causedBy(), cause.getClass().getName());
84+
out.format("@{bold %s} %s%n", messages.causedBy(), cause.getClass().getName());
8585
}
8686
}
8787
}

gshell-assembly/pom.xml

+4-4
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@
8585
<!--<artifactId>gshell-logging</artifactId>-->
8686
<!--</dependency>-->
8787

88-
<!--<dependency>-->
89-
<!--<groupId>com.planet57.gshell.commands</groupId>-->
90-
<!--<artifactId>gshell-shell</artifactId>-->
91-
<!--</dependency>-->
88+
<dependency>
89+
<groupId>com.planet57.gshell.commands</groupId>
90+
<artifactId>gshell-shell</artifactId>
91+
</dependency>
9292

9393
<!--<dependency>-->
9494
<!--<groupId>com.planet57.gshell.commands</groupId>-->

gshell-commands/gshell-file/src/main/java/com/planet57/gshell/commands/file/ListDirectoryAction.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,13 @@ private static String render(final File file) {
125125

126126
PrintBuffer buff = new PrintBuffer();
127127
if (file.isDirectory()) {
128-
buff.format("@|blue %s%s|@", name, File.separator);
128+
buff.format("@{fg:blue %s%s}", name, File.separator);
129129
}
130130
else if (file.canExecute()) {
131-
buff.format("@|green %s|@", name);
131+
buff.format("@{fg:green %s}", name);
132132
}
133133
else if (file.isHidden()) {
134-
buff.format("@|intensity_faint %s|@", name);
134+
buff.format("@{faint %s}", name);
135135
}
136136
else {
137137
// not styled

gshell-commands/gshell-file/src/main/resources/com/planet57/gshell/commands/file/ChangeDirectoryAction.help

+12-12
Original file line numberDiff line numberDiff line change
@@ -14,34 +14,34 @@
1414
# limitations under the License.
1515
#
1616

17-
@|bold NAME|@
17+
@{bold NAME}
1818

19-
@{command.name} - @{command.description}
19+
%{command.name} - %{command.description}
2020

21-
@|bold SYNOPSIS|@
21+
@{bold SYNOPSIS}
2222

23-
@|bold @{command.name}|@ [options] [PATH]
23+
@{bold %{command.name}} [options] [PATH]
2424

25-
@|bold DESCRIPTION|@
25+
@{bold DESCRIPTION}
2626

2727
Change the current working directory to a specific directory.
2828

29-
@{command.details}
29+
%{command.details}
3030

31-
@|bold EXAMPLES|@
31+
@{bold EXAMPLES}
3232

3333
Change to /tmp:
3434

35-
@{command.name} /tmp
35+
%{command.name} /tmp
3636

3737
Change to ${shell.user.home):
3838

39-
@{command.name}
39+
%{command.name}
4040

4141
Change to parent directory:
4242

43-
@{command.name} ..
43+
%{command.name} ..
4444

45-
@|bold SEE ALSO|@
45+
@{bold SEE ALSO}
4646

47-
@|bold pwd|@
47+
@{bold pwd}

gshell-commands/gshell-file/src/main/resources/com/planet57/gshell/commands/file/CopyAction.help

+10-10
Original file line numberDiff line numberDiff line change
@@ -14,27 +14,27 @@
1414
# limitations under the License.
1515
#
1616

17-
@|bold NAME|@
17+
@{bold NAME}
1818

19-
@{command.name} - @{command.description}
19+
%{command.name} - %{command.description}
2020

21-
@|bold SYNOPSIS|@
21+
@{bold SYNOPSIS}
2222

23-
@|bold @{command.name}|@ [options] SOURCE TARGET
23+
@{bold %{command.name}} [options] SOURCE TARGET
2424

25-
@|bold DESCRIPTION|@
25+
@{bold DESCRIPTION}
2626

2727
Copy directory or file
2828

29-
@{command.details}
29+
%{command.details}
3030

31-
@|bold EXAMPLES|@
31+
@{bold EXAMPLES}
3232

3333
Copy ./foo.txt to /tmp/:
3434

35-
@{command.name} ./foo.txt /tmp/
36-
@{command.name} ./foo.txt /tmp/foo.txt
35+
%{command.name} ./foo.txt /tmp/
36+
%{command.name} ./foo.txt /tmp/foo.txt
3737

3838
Copy directory ./foo to directory /tmp with recursive content
3939

40-
@{command.name} -r ./foo /tmp
40+
%{command.name} -r ./foo /tmp

gshell-commands/gshell-file/src/main/resources/com/planet57/gshell/commands/file/CreateDirectoryAction.help

+10-10
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,26 @@
1414
# limitations under the License.
1515
#
1616

17-
@|bold NAME|@
17+
@{bold NAME}
1818

19-
@{command.name} - @{command.description}
19+
%{command.name} - %{command.description}
2020

21-
@|bold SYNOPSIS|@
21+
@{bold SYNOPSIS}
2222

23-
@|bold @{command.name}|@ [options] PATH
23+
@{bold %{command.name}} [options] PATH
2424

25-
@|bold DESCRIPTION|@
25+
@{bold DESCRIPTION}
2626

2727
Creates a new directory if it does not already exist.
2828

29-
@{command.details}
29+
%{command.details}
3030

31-
@|bold EXAMPLES|@
31+
@{bold EXAMPLES}
3232

3333
Create a new directory:
3434

35-
@{command.name} /tmp/foo
35+
%{command.name} /tmp/foo
3636

37-
@|bold SEE ALSO|@
37+
@{bold SEE ALSO}
3838

39-
@|bold cd|@, @|bold rm|@, @|bold rmdir|@
39+
@{bold cd}, @{bold rm}, @{bold rmdir}

gshell-commands/gshell-file/src/main/resources/com/planet57/gshell/commands/file/CurrentDirectoryAction.help

+8-8
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,20 @@
1414
# limitations under the License.
1515
#
1616

17-
@|bold NAME|@
17+
@{bold NAME}
1818

19-
@{command.name} - @{command.description}
19+
%{command.name} - %{command.description}
2020

21-
@|bold SYNOPSIS|@
21+
@{bold SYNOPSIS}
2222

23-
@|bold @{command.name}|@ [options]
23+
@{bold %{command.name}} [options]
2424

25-
@|bold DESCRIPTION|@
25+
@{bold DESCRIPTION}
2626

2727
Displays the current working directory (ie. ${shell.user.dir}).
2828

29-
@{command.details}
29+
%{command.details}
3030

31-
@|bold SEE ALSO|@
31+
@{bold SEE ALSO}
3232

33-
@|bold cd|@
33+
@{bold cd}

gshell-commands/gshell-file/src/main/resources/com/planet57/gshell/commands/file/DeleteDirectoryAction.help

+10-10
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,24 @@
1414
# limitations under the License.
1515
#
1616

17-
@|bold NAME|@
17+
@{bold NAME}
1818

19-
@{command.name} - @{command.description}
19+
%{command.name} - %{command.description}
2020

21-
@|bold SYNOPSIS|@
21+
@{bold SYNOPSIS}
2222

23-
@|bold @{command.name}|@ [options] PATH
23+
@{bold %{command.name}} [options] PATH
2424

25-
@|bold DESCRIPTION|@
25+
@{bold DESCRIPTION}
2626

2727
Remove a directory; this command will only work if they directory is empty.
2828

29-
@{command.details}
29+
%{command.details}
3030

31-
@|bold EXAMPLES|@
31+
@{bold EXAMPLES}
3232

33-
@{command.name} /tmp/foo
33+
%{command.name} /tmp/foo
3434

35-
@|bold SEE ALSO|@
35+
@{bold SEE ALSO}
3636

37-
@|bold rm|@
37+
@{bold rm}

gshell-commands/gshell-file/src/main/resources/com/planet57/gshell/commands/file/DeleteFileAction.help

+10-10
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,24 @@
1414
# limitations under the License.
1515
#
1616

17-
@|bold NAME|@
17+
@{bold NAME}
1818

19-
@{command.name} - @{command.description}
19+
%{command.name} - %{command.description}
2020

21-
@|bold SYNOPSIS|@
21+
@{bold SYNOPSIS}
2222

23-
@|bold @{command.name}|@ [options] PATH
23+
@{bold %{command.name}} [options] PATH
2424

25-
@|bold DESCRIPTION|@
25+
@{bold DESCRIPTION}
2626

2727
Removes (deletes/unlinks) a file.
2828

29-
@{command.details}
29+
%{command.details}
3030

31-
@|bold EXAMPLES|@
31+
@{bold EXAMPLES}
3232

33-
@{command.name} /tmp/file.txt
33+
%{command.name} /tmp/file.txt
3434

35-
@|bold SEE ALSO|@
35+
@{bold SEE ALSO}
3636

37-
@|bold rmdir|@
37+
@{bold rmdir}

0 commit comments

Comments
 (0)