mirror of
https://github.com/appleboy/drone-scp.git
synced 2026-03-05 23:17:02 -05:00
- Change the `rmcmd` and `mkdircmd` functions to accept an OS parameter - Remove `command_windows.go` file - Modify `removeDestFile` and `Exec` functions to use the OS parameter - Add OS detection logic to `removeAllDestFile` and `Exec` functions - Modify `TestRemoveDestFile` function to use the OS parameter fix https://github.com/appleboy/drone-scp/pull/119
23 lines
361 B
Go
23 lines
361 B
Go
package main
|
|
|
|
func rmcmd(os, target string) string {
|
|
switch os {
|
|
case "windows":
|
|
return "DEL /F /S " + target
|
|
case "unix":
|
|
return "rm -rf " + target
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func mkdircmd(os, target string) string {
|
|
switch os {
|
|
case "windows":
|
|
return "if not exist " + target + " mkdir " + target
|
|
case "unix":
|
|
return "mkdir -p " + target
|
|
}
|
|
|
|
return ""
|
|
}
|