Skip to content

Commit 11d2b23

Browse files
Halo1236ZhaoJiSen
authored andcommitted
refactor: Simplify RDP command handling by removing unnecessary mapping and conditionals
1 parent bd547f9 commit 11d2b23

File tree

1 file changed

+2
-17
lines changed

1 file changed

+2
-17
lines changed

go-client/pkg/awaken/awaken_windows.go

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -91,24 +91,9 @@ func handleRDP(r *Rouse, filePath string, cfg *config.AppConfig) *exec.Cmd {
9191
return nil
9292
}
9393
}
94-
connectMap := map[string]string{
95-
"file": filePath,
96-
"name": r.getName(),
97-
"protocol": r.Protocol,
98-
"username": r.getUserName(),
99-
"value": r.Value,
100-
"host": r.Host,
101-
"port": strconv.Itoa(r.Port),
102-
}
103-
commands := strings.TrimSpace(getCommandFromArgs(connectMap, appItem.ArgFormat))
10494

105-
if strings.Contains(commands, "*") {
106-
commands := strings.Split(commands, "*")
107-
return exec.Command(appPath, commands...)
108-
} else {
109-
commands := strings.Split(commands, " ")
110-
return exec.Command(appPath, commands...)
111-
}
95+
args := strings.Replace(appItem.ArgFormat, "{file}", filePath, 1)
96+
return exec.Command(appPath, args)
11297
}
11398

11499
func handleVNC(r *Rouse, cfg *config.AppConfig) *exec.Cmd {

0 commit comments

Comments
 (0)