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.
13 lines
358 B
Go
13 lines
358 B
Go
package infra
|
|
|
|
// SSHConfigFind busca un entry por alias en la lista. Retorna el entry y true
|
|
// si lo encuentra, o un SSHConfigEntry vacio y false si no existe.
|
|
func SSHConfigFind(entries []SSHConfigEntry, alias string) (SSHConfigEntry, bool) {
|
|
for _, e := range entries {
|
|
if e.Alias == alias {
|
|
return e, true
|
|
}
|
|
}
|
|
return SSHConfigEntry{}, false
|
|
}
|