Skip to content

Commit 560ef7a

Browse files
authored
Add colored splash screen (#32)
- Fix error when pressing 1 in preprocessWatch
2 parents e85f2c5 + ab83196 commit 560ef7a

File tree

2 files changed

+28
-11
lines changed

2 files changed

+28
-11
lines changed

src/main/java/com/minecrafttas/discombobulator/Discombobulator.java

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -130,15 +130,7 @@ public void apply(Project project) {
130130
}
131131

132132
public static String getSplash() {
133-
return "\n" + " ( \n"
134-
+ " )\\ ) ) ) ( ) \n"
135-
+ "(()/( ( ) ( /( ( /( ( )\\ ) ( /( ( \n"
136-
+ " /(_)))\\ ( ( ( ( )\\()) ( )\\()) ))\\((_| /( )\\())( )( \n"
137-
+ "(_))_((_))\\ )\\ )\\ )\\ '((_)\\ )\\((_)\\ /((_)_ )(_)|_))/ )\\(()\\ \n"
138-
+ " | \\(_|(_)((_|(_)_((_)) | |(_) ((_) |(_|_))(| ((_)_| |_ ((_)((_) \n"
139-
+ " | |) | (_-< _/ _ \\ ' \\()| '_ \\/ _ \\ '_ \\ || | / _` | _/ _ \\ '_| \n"
140-
+ " |___/|_/__|__\\___/_|_|_| |_.__/\\___/_.__/\\_,_|_\\__,_|\\__\\___/_| \n"
141-
+ " \n" + "\n"
133+
return "\n" + (DISABLE_ANSI ? getColorLessSplash() : getColoredSplash()) + "\n\n"
142134
+ getCenterText(String.format("%sC%so%sl%so%sr%sf%su%sl%s!%s", RED, RED_BRIGHT, YELLOW, GREEN_BRIGHT, GREEN, CYAN, BLUE, PURPLE, PURPLE_BRIGHT, WHITE), 9) + "\n"
143135
+ " Created by Pancake and Scribble\n" + getCenterText(discoVersion) + "\n\n";
144136

@@ -185,4 +177,27 @@ public static void printError(String line) {
185177
public static void printError(String line, String filename) {
186178
printError(String.format("[%s] %s", filename, line));
187179
}
180+
181+
private static String getColoredSplash() {
182+
return " (\n"
183+
+ " )\\ ) ) ) ( )\n"
184+
+ "(()/( ( ) ( /( ( /( ( )\\ ) ( /( (\n"
185+
+ " /(_)))\\ ( ( ( ( )\\()) ( )\\()) ))\\((_| /( )\\())( )(\n"
186+
+ "(_))_((_))\\ )\\ )\\ )\\ '((_)\\ )\\((_)\\ /((_)_ )(_)(_))/ )\\(()\\\n"
187+
+ " | \\(_|(_)((_|(_)_((_)) | |(_) ((_) |(_|_))(| ((_)_| |_ ((_)((_)\n"
188+
+ " | |) | (_-< _/ _ \\ ' \\()| '_ \\/ _ \\ '_ \\ || | / _` | _/ _ \\ '_|\n"
189+
+ " |___/|_/__|__\\___/_|_|_| |_.__/\\___/_.__/\\_,_|_\\__,_|\\__\\___/_|\n";
190+
}
191+
192+
private static String getColorLessSplash() {
193+
return " ( \n"
194+
+ " )\\ ) ) ) ( ) \n"
195+
+ "(()/( ( ) ( /( ( /( ( )\\ ) ( /( ( \n"
196+
+ " /(_)))\\ ( ( ( ( )\\()) ( )\\()) ))\\((_| /( )\\())( )( \n"
197+
+ "(_))_((_))\\ )\\ )\\ )\\ '((_)\\ )\\((_)\\ /((_)_ )(_)(_))/ )\\(()\\ \n"
198+
+ " | \\(_|(_)((_|(_)_((_)) | |(_) ((_) |(_|_))(| ((_)_| |_ ((_)((_) \n"
199+
+ " | |) | (_-< _/ _ \\ ' \\()| '_ \\/ _ \\ '_ \\ || | / _` | _/ _ \\ '_| \n"
200+
+ " |___/|_/__|__\\___/_|_|_| |_.__/\\___/_.__/\\_,_|_\\__,_|\\__\\___/_| \n"
201+
+ " ";
202+
}
188203
}

src/main/java/com/minecrafttas/discombobulator/tasks/TaskPreprocessWatch.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,11 @@ public void preprocessWatch() {
9191
System.out.println("No recent file exists...\n");
9292
continue;
9393
}
94-
TaskPreprocessWatch.runFileAction(currentFileAction);
95-
currentFileAction = null;
9694

95+
TaskPreprocessWatch.runFileAction(currentFileAction);
9796
System.out.println(String.format("Preprocessed the recently edited file %s%s%s\n", PURPLE, currentFileAction.outFile().getFileName(), WHITE));
97+
98+
currentFileAction = null;
9899
}
99100
}
100101
} catch (IOException e1) {
@@ -280,6 +281,7 @@ public static void runFileAction(CurrentFilePreprocessAction currentFileAction)
280281
Path outFile = currentFileAction.outFile();
281282
List<String> outLines = currentFileAction.outLines();
282283

284+
Discombobulator.pathLock.scheduleAndLock(outFile.getParent());
283285
Discombobulator.pathLock.scheduleAndLock(outFile);
284286
Files.createDirectories(outFile.getParent());
285287
SafeFileOperations.write(outFile, outLines, StandardOpenOption.CREATE, StandardOpenOption.WRITE);

0 commit comments

Comments
 (0)