feat: 编排增加编辑功能

This commit is contained in:
ssongliu
2022-12-06 15:05:13 +08:00
committed by ssongliu
parent df31f71879
commit 0da3caba65
10 changed files with 180 additions and 17 deletions

View File

@@ -1,9 +1,10 @@
package compose
import (
"os/exec"
"github.com/compose-spec/compose-go/loader"
"github.com/compose-spec/compose-go/types"
"os/exec"
)
func Up(filePath string) (string, error) {
@@ -30,6 +31,12 @@ func Restart(filePath string) (string, error) {
return string(stdout), err
}
func Operate(filePath, operation string) (string, error) {
cmd := exec.Command("docker-compose", "-f", filePath, operation)
stdout, err := cmd.CombinedOutput()
return string(stdout), err
}
func Rmf(filePath string) (string, error) {
cmd := exec.Command("docker-compose", "-f", filePath, "rm", "-f")
stdout, err := cmd.CombinedOutput()