Skip to content

Commit

Permalink
fix: Fix local editor flag (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikew authored Oct 6, 2024
1 parent dbf73d3 commit b9e5cc3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ CATEGORY:
OPTIONS:
--server-env value [ --server-env value ] Environment variables to set on the remote server
--local-editor {{SOCKET_PATH}} [ --local-editor {{SOCKET_PATH}} ] Local editor to use. {{SOCKET_PATH}} will be replaced with the socket path
--local-editor {{SOCKET_PATH}} [ --local-editor {{SOCKET_PATH}} ] Local editor to use. {{SOCKET_PATH}} will be replaced with the socket path (default: "nvim", "--server", "{{SOCKET_PATH}}", "--remote-ui")
--help, -h show help
```

Expand Down
7 changes: 2 additions & 5 deletions src/client/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ var CliClientOpenCommand = cli.Command{
&cli.StringSliceFlag{
Name: "local-editor",
Usage: "Local editor to use. `{{SOCKET_PATH}}` will be replaced with the socket path",
Value: cli.NewStringSlice("nvim", "--server", "{{SOCKET_PATH}}", "--remote-ui"),
},
},

Expand All @@ -51,7 +52,7 @@ var CliClientOpenCommand = cli.Command{
server := c.Args().Get(0)
directory := c.Args().Get(1)
serverEnvPairs := c.StringSlice("server-env")
localEditor := c.StringSlice("server-env")
localEditor := c.StringSlice("local-editor")

if server == "" {
return fmt.Errorf("<server> is required")
Expand Down Expand Up @@ -126,10 +127,6 @@ func startLocalEditor(socketPath string, args []string) {
replacedArgs[i] = strings.Replace(arg, "{{SOCKET_PATH}}", socketPath, -1)
}

if len(replacedArgs) == 0 {
replacedArgs = []string{"nvim", "--server", socketPath, "--remote-ui"}
}

log.Printf("Starting local editor: %v", replacedArgs)

// editorCommand := exec.Command("nvim-qt", "--server", socketPath)
Expand Down

0 comments on commit b9e5cc3

Please sign in to comment.