Skip to content

Commit aa774c0

Browse files
committed
Rename refactorCmd to editCmd and update related texts and flags
1 parent cb81aee commit aa774c0

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

cmd/refactor.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ import (
1717
"github.com/spf13/cobra"
1818
)
1919

20-
// refactorCmd represents the refactor command
21-
var refactorCmd = &cobra.Command{
22-
Use: "refactor",
20+
// editCmd represents the edit command
21+
var editCmd = &cobra.Command{
22+
Use: "edit",
2323
Short: "A brief description of your command",
2424
Long: `A longer description that spans multiple lines and likely contains examples
2525
and usage of using your command. For example:
@@ -35,7 +35,7 @@ to quickly create a Cobra application.`,
3535
},
3636
Run: func(cmd *cobra.Command, args []string) {
3737
if len(args) == 0 {
38-
log.Error("Requires a file name as an argument. Example: otto refactor main.go")
38+
log.Error("Requires a file name as an argument. Example: otto edit main.go")
3939
os.Exit(1)
4040
}
4141

@@ -60,7 +60,7 @@ to quickly create a Cobra application.`,
6060
}
6161

6262
if endLine != 0 {
63-
// get the lines to refactor
63+
// get the lines to edit
6464
lines := strings.Split(contents, "\n")
6565
if endLine > len(lines) {
6666
log.Error("End line is greater than the number of lines in the file")
@@ -72,7 +72,7 @@ to quickly create a Cobra application.`,
7272
endLine = len(strings.Split(contents, "\n"))
7373
}
7474

75-
log.Debugf("Refactoring lines %d-%d", startLine, endLine)
75+
log.Debugf("editing lines %d-%d", startLine, endLine)
7676

7777
if chatPrompt == "" {
7878
chatPrompt, err = utils.Input("Goal: ")
@@ -82,7 +82,7 @@ to quickly create a Cobra application.`,
8282
}
8383
}
8484

85-
prompt := constants.REFACTOR_CODE_PROMPT + "Goal: " + chatPrompt + "\n\n" + strings.TrimRight(contents, " \n")
85+
prompt := constants.EDIT_CODE_PROMPT + "Goal: " + chatPrompt + "\n\n" + strings.TrimRight(contents, " \n")
8686

8787
stream, err := ai.SimpleStreamRequest(prompt, c)
8888
if err != nil {
@@ -128,11 +128,11 @@ to quickly create a Cobra application.`,
128128
}
129129

130130
func init() {
131-
RootCmd.AddCommand(refactorCmd)
131+
RootCmd.AddCommand(editCmd)
132132

133-
refactorCmd.Flags().BoolVarP(&force, "force", "f", false, "Force overwrite of existing files")
134-
refactorCmd.Flags().BoolVarP(&verbose, "verbose", "v", false, "Verbose output")
135-
refactorCmd.Flags().IntVarP(&startLine, "start", "s", 1, "Start line")
136-
refactorCmd.Flags().IntVarP(&endLine, "end", "e", 0, "End line")
137-
refactorCmd.Flags().StringVarP(&chatPrompt, "goal", "g", "", "Goal of the refactor")
133+
editCmd.Flags().BoolVarP(&force, "force", "f", false, "Force overwrite of existing files")
134+
editCmd.Flags().BoolVarP(&verbose, "verbose", "v", false, "Verbose output")
135+
editCmd.Flags().IntVarP(&startLine, "start", "s", 1, "Start line")
136+
editCmd.Flags().IntVarP(&endLine, "end", "e", 0, "End line")
137+
editCmd.Flags().StringVarP(&chatPrompt, "goal", "g", "", "Goal of the edit")
138138
}

pkg/constants/prompts.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,4 @@ var PR_BODY_PROMPT string = "You are a helpful assistant who writes pull request
4040

4141
var COMPRESS_DIFF_PROMPT string = "You are a helpful assistant who describes git diff changes. You will be given a Git diff and you should use it to create a description of the changes. The description should be no longer than 75 characters long and should describe the changes in the diff. Do not include the file names in the description."
4242

43-
var REFACTOR_CODE_PROMPT string = `You are a helpful assistant who refactors code. You will be given a file what you are trying to accomplish in the refactor and you should refactor it to the best of your abilities. You should only output the code and should not output any other text.\n`
43+
var EDIT_CODE_PROMPT string = `You are a helpful assistant who edits code. You will be given a file what you are trying to accomplish in the edit and you should edit it to the best of your abilities. You should only output the code and should not output any other text.\n`

0 commit comments

Comments
 (0)