feat: add Go SSH config management functions and type

7 funciones Go del dominio infra para gestion programatica de ~/.ssh/config:
ssh_config_parse (parser de bloques Host/Match), ssh_config_read (lectura del
archivo), ssh_config_find (busqueda por host), ssh_config_add_entry y
ssh_config_remove_entry (CRUD), ssh_config_render (serializacion a texto),
ssh_config_write (escritura atomica). Incluye tipo SshConfigEntry (product type)
y tests unitarios del parser.
This commit is contained in:
2026-04-12 13:54:43 +02:00
parent 773bb3a523
commit f2753e6fff
17 changed files with 834 additions and 0 deletions
@@ -0,0 +1,37 @@
---
name: ssh_config_remove_entry
kind: function
lang: go
domain: infra
version: "1.0.0"
purity: pure
signature: "func SSHConfigRemoveEntry(entries []SSHConfigEntry, alias string) ([]SSHConfigEntry, error)"
description: "Elimina un entry por alias de la lista. Error si el alias no existe."
tags: [ssh, config, remove, remote]
uses_functions: []
uses_types: [ssh_config_entry_go_infra]
returns: []
returns_optional: false
error_type: ""
imports: [fmt]
params:
- name: entries
desc: "lista actual de SSHConfigEntry"
- name: alias
desc: "alias del host a eliminar"
output: "nueva lista sin el entry eliminado"
tested: true
tests: ["elimina entry existente", "error si alias no existe"]
test_file_path: "functions/infra/ssh_config_parse_test.go"
file_path: "functions/infra/ssh_config_remove_entry.go"
---
## Ejemplo
```go
updated, err := SSHConfigRemoveEntry(entries, "old-server")
```
## Notas
No muta el slice original — crea una copia nueva sin el entry eliminado.