fix(cmd/edit): implement removal of "last modified" comments
The removeLastModifiedComments function previously copied all lines without filtering. This change adds logic to remove lines containing "last modified" (case-insensitive) after trimming whitespace.
This commit is contained in:
parent
edb986dd1a
commit
0b3e544143
@ -103,7 +103,11 @@ var editCmd = &cobra.Command{
|
||||
func removeLastModifiedComments(content string) string {
|
||||
lines := strings.Split(content, "\n")
|
||||
cleanedLines := make([]string, 0, len(lines))
|
||||
cleanedLines = append(cleanedLines, lines...)
|
||||
|
||||
for _, line := range lines {
|
||||
trimmed := strings.TrimSpace(line)
|
||||
if !strings.Contains(strings.ToLower(trimmed), "last modified") {
|
||||
cleanedLines = append(cleanedLines, line)
|
||||
}
|
||||
}
|
||||
return strings.Join(cleanedLines, "\n")
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user