From 2f6c8006d004c66f7e97b69fdc5f7794d6e26df3 Mon Sep 17 00:00:00 2001 From: Matt Low Date: Sun, 26 Nov 2023 15:51:04 +0000 Subject: [PATCH] Ranamed modify_file's 'insert' operation to 'insert_before' --- pkg/cli/functions.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/cli/functions.go b/pkg/cli/functions.go index 14371cf..d193262 100644 --- a/pkg/cli/functions.go +++ b/pkg/cli/functions.go @@ -168,7 +168,7 @@ To replace or remove a single line, *set start_line and end_line to the same val Examples: * Insert the lines "helloworld" at line 10, preserving other content: - {"path": "myfile", "operation": "insert", "start_line": 10, "content": "hello\nworld"} + {"path": "myfile", "operation": "insert_before", "start_line": 10, "content": "hello\nworld"} * Remove lines 45 up to and including 54: {"path": "myfile", "operation": "remove", "start_line": 45, "end_line": 54} @@ -187,7 +187,7 @@ Examples: }, "operation": { Type: "string", - Description: `The the type of modification to make to the file. One of: insert, remove, replace`, + Description: `The the type of modification to make to the file. One of: insert_before, remove, replace`, }, "start_line": { Type: "integer", @@ -478,7 +478,7 @@ func ModifyFile(path string, operation string, content string, startLine int, en contentLines := strings.Split(strings.Trim(content, "\n"), "\n") switch operation { - case "insert": + case "insert_before": // Insert new lines before := lines[:startLine-1] after := append(contentLines, lines[startLine-1:]...)