Skip to content

Commit 6f1c085

Browse files
committed
refactor: better error & info messages
1 parent 8d06f55 commit 6f1c085

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

build.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
$classes=".\src\*.java .\src\Application\*.java .\src\Application\Operations\*.java .\src\Application\Utils\*.java "
22
$libs=""
33
$compile="javac -d .\bin\ $classes"
4-
$run="java -cp '.\bin\;' 'JavaBuildConfig' --compile"
4+
$run="java -cp '.\bin\;' 'JavaBuildConfig' --h"
55
$invoke=$compile + " && " + $run
66
Invoke-Expression $invoke

src/Application/Utils/FileUtils.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,11 @@ public void writeToFile(String file, String sentences) {
144144
try {
145145
f = new File(rootFilePath + file);
146146
if(f.exists()) {
147-
System.out.println("[Error] config already exists");
147+
System.out.println(String.format("[Error] file '%s' already exists", file));
148148
} else {
149-
System.out.println("[Info] config doesn't exists and it will be created");
149+
System.out.println(
150+
String.format("[Info] file '%s' doesn't exists and it will be created", file)
151+
);
150152
fw = new FileWriter(rootFilePath + file);
151153
fw.write(sentences);
152154
}

src/JavaBuildConfig.java

+6
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ public static void main(String[] args) {
2424
System.out.println("[Info] creating build script in root");
2525
cp.createBuildScript();
2626
break;
27+
case "-cc":
28+
System.out.println("[Info] not implemented yet");
29+
break;
2730
default:
2831
System.out.println("\n[Info] use --h or --help to show command options");
2932
break;
@@ -37,5 +40,8 @@ private static void messages() {
3740
System.out.println("[Info] use --compile to compile the project");
3841
System.out.println("[Info] use --run to execute the project");
3942
System.out.println("[Info] use --jar to create the project jar compress file");
43+
System.out.println("[Info] use -cb to create the build script");
44+
System.out.println("[Info] use -cc to create the config file");
45+
System.out.println("\t \bNot implemented yet");
4046
}
4147
}

0 commit comments

Comments
 (0)