Skip to content

Commit 19bbc6a

Browse files
committed
refactor: refactor command handler method names for consistency
- Renamed command handler methods for consistency (e.g., `askFiles` to `ask`, `addFiles` to `add`, etc.). - Updated comments to reflect the renamed methods. Signed-off-by: codiing-hui <wecoding@yeah.net>
1 parent 90dc662 commit 19bbc6a

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

internal/ui/coders/commands.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ func NewCommandExecutor(coder *AutoCoder) *CommandExecutor {
5050
}
5151

5252
func (c *CommandExecutor) registryCmds() {
53-
supportCommands["add"] = c.addFiles
54-
supportCommands["list"] = c.listFiles
55-
supportCommands["remove"] = c.removeFiles
56-
supportCommands["ask"] = c.askFiles
57-
supportCommands["drop"] = c.dropFiles
53+
supportCommands["add"] = c.add
54+
supportCommands["list"] = c.list
55+
supportCommands["remove"] = c.remove
56+
supportCommands["ask"] = c.ask
57+
supportCommands["drop"] = c.drop
5858
supportCommands["coding"] = c.coding
5959
supportCommands["commit"] = c.commit
6060
supportCommands["undo"] = c.undo
@@ -101,8 +101,8 @@ func (c *CommandExecutor) Executor(input string) {
101101
}
102102
}
103103

104-
// askFiles Ask GPT to edit the files in the chat
105-
func (c *CommandExecutor) askFiles(ctx context.Context, args ...string) error {
104+
// ask Ask GPT to edit the files in the chat
105+
func (c *CommandExecutor) ask(ctx context.Context, args ...string) error {
106106
messages, err := c.prepareAskCompletionMessages(strings.Join(args, " "))
107107
if err != nil {
108108
return errbook.Wrap("Failed to prepare ask completion messages", err)
@@ -117,7 +117,7 @@ func (c *CommandExecutor) askFiles(ctx context.Context, args ...string) error {
117117
return chatModel.Run()
118118
}
119119

120-
// addFiles Add files to the chat so GPT can edit them or review them in detail
120+
// add Add files to the chat so GPT can edit them or review them in detail
121121
func (c *CommandExecutor) loadFileContent(path string) (string, error) {
122122
// Handle remote URLs
123123
if rest.IsValidURL(path) {
@@ -135,7 +135,7 @@ func (c *CommandExecutor) loadFileContent(path string) (string, error) {
135135
return string(content), nil
136136
}
137137

138-
func (c *CommandExecutor) addFiles(_ context.Context, files ...string) (err error) {
138+
func (c *CommandExecutor) add(_ context.Context, files ...string) (err error) {
139139
if len(files) <= 0 {
140140
return errbook.New("Please provide at least one file or URL")
141141
}
@@ -218,8 +218,8 @@ func (c *CommandExecutor) addFiles(_ context.Context, files ...string) (err erro
218218
return nil
219219
}
220220

221-
// listFiles List all files that have been added to the chat
222-
func (c *CommandExecutor) listFiles(_ context.Context, _ ...string) error {
221+
// list List all files that have been added to the chat
222+
func (c *CommandExecutor) list(_ context.Context, _ ...string) error {
223223
if len(c.coder.loadedContexts) <= 0 {
224224
console.Render("No files added in chat currently")
225225
return nil
@@ -241,8 +241,8 @@ func (c *CommandExecutor) listFiles(_ context.Context, _ ...string) error {
241241
return nil
242242
}
243243

244-
// removeFiles Remove files from the chat so GPT won't edit them or review them in detail
245-
func (c *CommandExecutor) removeFiles(_ context.Context, files ...string) error {
244+
// remove Remove files from the chat so GPT won't edit them or review them in detail
245+
func (c *CommandExecutor) remove(_ context.Context, files ...string) error {
246246
if len(files) <= 0 {
247247
return errbook.New("Please provide at least one file")
248248
}
@@ -281,7 +281,7 @@ func (c *CommandExecutor) removeFiles(_ context.Context, files ...string) error
281281
return nil
282282
}
283283

284-
func (c *CommandExecutor) dropFiles(_ context.Context, _ ...string) error {
284+
func (c *CommandExecutor) drop(_ context.Context, _ ...string) error {
285285
dropCount := len(c.coder.loadedContexts)
286286

287287
// Clean all contexts from persistence store

0 commit comments

Comments
 (0)