diff --git a/main.go b/main.go index f80d87cd1f0b5fca86fcc29f9285a1c276d91f0f..2bac49b69f14099f19f78e143a32cc646854e40d 100644 --- a/main.go +++ b/main.go @@ -123,34 +123,7 @@ func main() { fmt.Printf("%d. %s (Type: %s)\n", i+1, conn.Name, connType) } - case "delete-connection": - // If connection name not provided via command line, get it from config - connNameToDelete := *connectionName - if connNameToDelete == "" { - // If there's only one connection in config, use that - if len(cfg.Connections) == 1 { - connNameToDelete = cfg.Connections[0].Name - fmt.Printf("Using connection name from config: %s\n", connNameToDelete) - } else if len(cfg.Connections) > 1 { - // If multiple connections, show the available options - fmt.Println("Multiple connections found in config. Please specify which one to delete with --name flag:") - for i, conn := range cfg.Connections { - fmt.Printf("%d. %s\n", i+1, conn.Name) - } - os.Exit(1) - } else { - log.Fatalf("No connections found in config file") - } - } - - log.Printf("Deleting connection %s in project %s (location: %s)", - connNameToDelete, projectIDValue, locationValue) - - err := client.DeleteConnection(projectIDValue, locationValue, connNameToDelete) - if err != nil { - log.Fatalf("Failed to delete connection: %v", err) - } - fmt.Printf("Successfully deleted connection: %s\n", connNameToDelete) + case "list-linkable-repos": // If connection name not provided via command line, get it from config @@ -191,6 +164,35 @@ func main() { fmt.Println() } } + + case "delete-connection": + // If connection name not provided via command line, get it from config + connNameToDelete := *connectionName + if connNameToDelete == "" { + // If there's only one connection in config, use that + if len(cfg.Connections) == 1 { + connNameToDelete = cfg.Connections[0].Name + fmt.Printf("Using connection name from config: %s\n", connNameToDelete) + } else if len(cfg.Connections) > 1 { + // If multiple connections, show the available options + fmt.Println("Multiple connections found in config. Please specify which one to delete with --name flag:") + for i, conn := range cfg.Connections { + fmt.Printf("%d. %s\n", i+1, conn.Name) + } + os.Exit(1) + } else { + log.Fatalf("No connections found in config file") + } + } + + log.Printf("Deleting connection %s in project %s (location: %s)", + connNameToDelete, projectIDValue, locationValue) + + err := client.DeleteConnection(projectIDValue, locationValue, connNameToDelete) + if err != nil { + log.Fatalf("Failed to delete connection: %v", err) + } + fmt.Printf("Successfully deleted connection: %s\n", connNameToDelete) case "inspect": // This action provides detailed inspection of a connection's configuration and status