Closed Halimao closed 6 months ago
By state string, do you mean the message? (e.g. "Download complete" in Case 2) Or do you mean the entire line that is displayed (including the ####
characters and everything)?
I assume you mean the latter. There is no built-in way, but you can probably make it work by implementing the TermLike
trait and sort of "fork" (or tee) the output to the actual terminal and an InMemoryTerm
. Then you use the InMemoryTerm
to get the output.
@chris-laplante Hi sir, thanks for your reply. I indeed mean the latter, get the entire line that is displayed to user. I will try the way you suggested, thanks again.
@chris-laplante Hi sir, thanks for your reply. I indeed mean the latter, get the entire line that is displayed to user. I will try the way you suggested, thanks again.
Sure thing, just let me know if have issues with it :)
Summary
Is there a way that we could get the latest progress bar state just like output in the terminal, something like following cases, get the progress bar state string that is shown to user
Case1: downloading or download process terminate
Case2: downloaded successfully