ab7317b0c0
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.
983 B
983 B
name, kind, lang, domain, version, purity, signature, description, tags, uses_functions, uses_types, returns, returns_optional, error_type, imports, params, output, tested, tests, test_file_path, file_path
| name | kind | lang | domain | version | purity | signature | description | tags | uses_functions | uses_types | returns | returns_optional | error_type | imports | params | output | tested | tests | test_file_path | file_path | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ssh_config_read | function | go | infra | 1.0.0 | impure | func SSHConfigRead() ([]SSHConfigEntry, error) | Lee y parsea ~/.ssh/config. Retorna lista vacia si el archivo no existe. |
|
|
|
false | error_go_core |
|
lista de SSHConfigEntry parseados del archivo ~/.ssh/config | false | functions/infra/ssh_config_read.go |
Ejemplo
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.