Skip to content

Commit

Permalink
fix bug where every line is removed in config (#631)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nepoxx committed Apr 6, 2024
1 parent 1ce074b commit fa945c3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/shells/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func AppendLine(file string, line string) error {
}

// RemoveLine removes a line from a file if it exists
func RemoveLine(file string, line string) error {
func RemoveLine(file string, lineToRemove string) error {
b, err := os.ReadFile(file)
if err != nil {
return err
Expand All @@ -48,7 +48,7 @@ func RemoveLine(file string, line string) error {

lines := strings.Split(string(b), "\n")
for i, line := range lines {
removeLine := strings.Contains(line, line)
removeLine := strings.Contains(line, lineToRemove)

// When removing the line, if the line after is empty we
// remove that too. This prevents the length of the config file growing by 1 with blank lines
Expand Down

0 comments on commit fa945c3

Please sign in to comment.