mirror of
https://github.com/NekoMonci12/Git-Craft.git
synced 2025-12-19 23:09:15 +00:00
Fix Commit Name Cant Whitespace
This commit is contained in:
@@ -22,16 +22,25 @@ public class GitCommitSubcommand implements SubcommandExecutor {
|
|||||||
File repoFolder = new File(".");
|
File repoFolder = new File(".");
|
||||||
String message = "Commit from Minecraft";
|
String message = "Commit from Minecraft";
|
||||||
|
|
||||||
|
StringBuilder messageBuilder = new StringBuilder();
|
||||||
for (int i = 0; i < args.length; i++) {
|
for (int i = 0; i < args.length; i++) {
|
||||||
String arg = args[i];
|
String arg = args[i];
|
||||||
if (arg.startsWith("--path=")) {
|
if (arg.startsWith("--path=")) {
|
||||||
repoFolder = new File(arg.substring("--path=".length()));
|
repoFolder = new File(arg.substring("--path=".length()));
|
||||||
} else if (arg.startsWith("--message=")) {
|
} else if (arg.startsWith("--message=")) {
|
||||||
message = arg.substring("--message=".length());
|
messageBuilder.append(arg.substring("--message=".length())).append(" ");
|
||||||
} else if (arg.equals("-m") && i + 1 < args.length) {
|
} else if (arg.startsWith("-m=")) {
|
||||||
message = args[i + 1];
|
messageBuilder.append(arg.substring("-m=".length())).append(" ");
|
||||||
i++; // Skip next token
|
} else if (arg.equals("-m") || arg.equals("--message")) {
|
||||||
|
for (int j = i + 1; j < args.length; j++) {
|
||||||
|
messageBuilder.append(args[j]).append(" ");
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (messageBuilder.length() > 0) {
|
||||||
|
message = messageBuilder.toString().trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (message.length() > 50) {
|
if (message.length() > 50) {
|
||||||
|
|||||||
Reference in New Issue
Block a user