Correction de bug

This commit is contained in:
Moncef STITI 2025-03-16 17:36:39 +01:00
parent d376760816
commit f5dfdb93de

@ -95,16 +95,24 @@ public class CommandExecutor {
boolean isFirstLine = true;
for (String line : displayLines) {
if (isFirstLine) {
// Pour la première ligne, supprimer l'indentation
// Pour la première ligne, supprimer l'indentation et le tiret si présent
String displayLine = line;
if (displayLine.startsWith("\t")) {
displayLine = displayLine.substring(1);
}
// Supprimer le tiret d'ignore-errors si présent
if (ignoreErrors && displayLine.trim().startsWith("-")) {
displayLine = displayLine.replaceFirst("\\s*-\\s*", " ").trim();
}
System.out.println(displayLine);
isFirstLine = false;
} else {
// Pour les lignes suivantes, également supprimer l'indentation
if (line.startsWith("\t")) {
System.out.println(line.substring(1));
} else {
System.out.println(line);
}
isFirstLine = false;
} else {
// Pour les lignes suivantes, conserver l'indentation
System.out.println(line);
}
}
}
@ -116,6 +124,11 @@ public class CommandExecutor {
if(!isCircular && !silent){
String displayCommand = BakefileParser.expandVariables(command);
// Supprimer le tiret d'ignore-errors si présent dans displayCommand
if (ignoreErrors && displayCommand.trim().startsWith("-")) {
displayCommand = displayCommand.replaceFirst("\\s*-\\s*", " ").trim();
}
// Afficher les lignes formatées avec traitement spécial pour les continuations
if (displayLines != null && !displayLines.isEmpty()) {
boolean isFirstLine = true;
@ -126,16 +139,25 @@ public class CommandExecutor {
String expandedLine = line;
if (line.startsWith("\t")) {
String content = line.substring(1);
expandedLine = "\t" + BakefileParser.expandVariables(content);
System.out.println(expandedLine.substring(1));
expandedLine = BakefileParser.expandVariables(content);
} else {
expandedLine = BakefileParser.expandVariables(line);
System.out.println(expandedLine);
}
// Supprimer le tiret d'ignore-errors si présent
if (ignoreErrors && expandedLine.trim().startsWith("-")) {
expandedLine = expandedLine.replaceFirst("\\s*-\\s*", " ").trim();
}
System.out.println(expandedLine);
isFirstLine = false;
} else {
// Pour les lignes suivantes d'une continuation, conserver l'indentation
String expandedLine = BakefileParser.expandVariables(line);
// Pour les lignes suivantes d'une continuation, supprimer également l'indentation
String expandedLine = line;
if (line.startsWith("\t")) {
expandedLine = BakefileParser.expandVariables(line.substring(1));
} else {
expandedLine = BakefileParser.expandVariables(line);
}
System.out.println(expandedLine);
}
}