feat: 🚛 完成了 client 资源创建

This commit is contained in:
zhaoyupeng
2025-12-31 17:31:25 +08:00
parent 0bcb138fd5
commit eb87d6fbed
20 changed files with 632 additions and 60 deletions

View File

@@ -0,0 +1,28 @@
package maker
import (
"context"
"fmt"
"os/exec"
)
func (m *maker) RunCommand(ctx context.Context, dir string, _cmds ...string) error {
if len(_cmds) == 0 {
return nil
}
for _, cmdStr := range _cmds {
cmd := exec.CommandContext(ctx, "sh", "-c", cmdStr)
if dir != "" {
cmd.Dir = dir
}
// Execute the command
if err := cmd.Run(); err != nil {
return fmt.Errorf("failed to run command '%s' in directory '%s': %w", cmdStr, dir, err)
}
}
return nil
}