Skip to content
Snippets Groups Projects
Commit f9835d90 authored by Shreyas Prabhu's avatar Shreyas Prabhu
Browse files

Refactor vq

parent b986f3b0
No related branches found
No related tags found
No related merge requests found
...@@ -123,34 +123,7 @@ func main() { ...@@ -123,34 +123,7 @@ func main() {
fmt.Printf("%d. %s (Type: %s)\n", i+1, conn.Name, connType) 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": case "list-linkable-repos":
// If connection name not provided via command line, get it from config // If connection name not provided via command line, get it from config
...@@ -192,6 +165,35 @@ func main() { ...@@ -192,6 +165,35 @@ func main() {
} }
} }
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": case "inspect":
// This action provides detailed inspection of a connection's configuration and status // This action provides detailed inspection of a connection's configuration and status
// If connection name not provided via command line, get it from config // If connection name not provided via command line, get it from config
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment