Closed hellt closed 3 years ago
Gunna close per our chat offline.
For anyone else curious: tldr is that prompt
(usually) coming from a user and is always a string, but can be a string that looks like a pattern. Users can pass this via send interactive for example. So we always wanna compile even if its not the most efficient thing. In hind sight it may have been better to have options for string pattern vs prompt pattern -- one of these days I may get around to doing that so it is more explicit and can just do the right thing vs just blindly compiling no mater what.
@carlmontanari there is two methods
readUntilPrompt
defined in netconf and base channel packagesThose functions use RE compilation out of a prompt, which happens to be a string, not a RE. I think it makes it more performant to use
bytes.Contains
instead of matching RE compiled of a single stringhttps://github.com/scrapli/scrapligo/blob/6dd77b8af3c20e609560c051d5f73e4c54e55d6f/channel/base.go#L115-L138