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,12 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user