Skip to content

Commit 85ad3a8

Browse files
committed
Fixed review comments and changed the usage doc
1 parent c0fc720 commit 85ad3a8

4 files changed

Lines changed: 7 additions & 5 deletions

File tree

cmd/cli/commands/run.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ func generateInteractiveWithReadline(cmd *cobra.Command, desktopClient *desktop.
132132
fmt.Fprintln(os.Stderr, " Ctrl + w Delete the word before the cursor")
133133
fmt.Fprintln(os.Stderr, "")
134134
fmt.Fprintln(os.Stderr, " Ctrl + l Clear the screen")
135-
fmt.Fprintln(os.Stderr, " Ctrl + x Open prompt in text editor ($EDITOR)")
135+
fmt.Fprintln(os.Stderr, " Ctrl + x Open prompt in your default text editor")
136136
fmt.Fprintln(os.Stderr, " Ctrl + c Stop the model from responding")
137137
fmt.Fprintln(os.Stderr, " Ctrl + d Exit (/bye)")
138138
fmt.Fprintln(os.Stderr, "")

cmd/cli/readline/editor.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,7 @@ func buildEditorCmd(filePath string) *exec.Cmd {
5757

5858
if shell {
5959
// The editor string is the last element — append the file path to it
60-
// so the shell interprets the full command.
61-
args[len(args)-1] = fmt.Sprintf("%s %s", args[len(args)-1], filePath)
60+
args[len(args)-1] = fmt.Sprintf("%s '%s'", args[len(args)-1], filePath)
6261
} else {
6362
args = append(args, filePath)
6463
}

cmd/cli/readline/readline_unix.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
package readline
44

55
import (
6+
"errors"
67
"syscall"
78
)
89

@@ -28,7 +29,7 @@ func openInEditor(fd uintptr, termios any, content string) (string, error) {
2829
edited, err := runEditor(content)
2930

3031
if _, restoreErr := SetRawMode(fd); restoreErr != nil {
31-
return content, restoreErr
32+
return content, errors.Join(err, restoreErr)
3233
}
3334

3435
if err != nil {

cmd/cli/readline/readline_windows.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package readline
22

3+
import "errors"
4+
35
func handleCharCtrlZ(fd uintptr, state any) (string, error) {
46
// not supported
57
return "", nil
@@ -15,7 +17,7 @@ func openInEditor(fd uintptr, termios any, content string) (string, error) {
1517
edited, err := runEditor(content)
1618

1719
if _, restoreErr := SetRawMode(fd); restoreErr != nil {
18-
return content, restoreErr
20+
return content, errors.Join(err, restoreErr)
1921
}
2022

2123
if err != nil {

0 commit comments

Comments
 (0)