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:
@@ -0,0 +1,39 @@
|
||||
---
|
||||
name: ssh_config_read
|
||||
kind: function
|
||||
lang: go
|
||||
domain: infra
|
||||
version: "1.0.0"
|
||||
purity: impure
|
||||
signature: "func SSHConfigRead() ([]SSHConfigEntry, error)"
|
||||
description: "Lee y parsea ~/.ssh/config. Retorna lista vacia si el archivo no existe."
|
||||
tags: [ssh, config, read, remote]
|
||||
uses_functions: [ssh_config_parse_go_infra]
|
||||
uses_types: [ssh_config_entry_go_infra]
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: "error_go_core"
|
||||
imports: [fmt, os, path/filepath]
|
||||
params: []
|
||||
output: "lista de SSHConfigEntry parseados del archivo ~/.ssh/config"
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "functions/infra/ssh_config_read.go"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```go
|
||||
entries, err := SSHConfigRead()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
for _, e := range entries {
|
||||
fmt.Printf("%s -> %s@%s\n", e.Alias, e.User, e.HostName)
|
||||
}
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
Si `~/.ssh/config` no existe, retorna lista vacia y nil (no es error — el usuario simplemente no tiene config aun). Usa `SSHConfigParse` internamente.
|
||||
Reference in New Issue
Block a user