fix: host lookup by hostname, interactive input with spaces
This commit is contained in:
@@ -103,6 +103,20 @@ func findHost(ctx context.Context, store storage.Storage, identifier string) (*m
|
||||
}
|
||||
}
|
||||
|
||||
// Try to find by hostname
|
||||
for _, h := range hosts {
|
||||
if h.Hostname == identifier {
|
||||
return h, nil
|
||||
}
|
||||
}
|
||||
|
||||
// Try to find by ID prefix (short ID match)
|
||||
for _, h := range hosts {
|
||||
if len(h.ID) >= 8 && h.ID[:8] == identifier {
|
||||
return h, nil
|
||||
}
|
||||
}
|
||||
|
||||
// Host not found, provide helpful error
|
||||
return nil, fmt.Errorf("host '%s' not found. Use 'hostkeeper list' to see available hosts", identifier)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user