edit bugs

This commit is contained in:
2025-11-14 21:46:07 +07:00
parent 5182460b69
commit fb68f1833d
7 changed files with 171 additions and 0 deletions

13
main.go
View File

@@ -25,8 +25,10 @@ type Config struct {
func main() {
config := &Config{}
var configFile string
var batchFile string
flag.StringVar(&configFile, "config", "", "Config file path (YAML)")
flag.StringVar(&batchFile, "batch", "", "Batch file with multiple config paths (one per line)")
flag.StringVar(&config.ImageURL, "image-url", "", "Cloud image URL to download")
flag.StringVar(&config.VMName, "vm-name", "cloud-vm", "VM name")
flag.IntVar(&config.VMID, "vm-id", 0, "VM ID (0 = auto-find from 10000+)")
@@ -43,6 +45,17 @@ func main() {
flag.Parse()
// Batch mode
if batchFile != "" {
if err := runBatch(batchFile); err != nil {
fmt.Fprintf(os.Stderr, "Batch error: %v\n", err)
os.Exit(1)
}
fmt.Println("\nAll templates created successfully!")
return
}
// Single config mode
if configFile != "" {
if err := loadConfigFile(configFile, config); err != nil {
fmt.Fprintf(os.Stderr, "Error loading config file: %v\n", err)