Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide spinner and progress when done #171

Closed
layday opened this issue Dec 3, 2021 · 10 comments · Fixed by #174
Closed

Hide spinner and progress when done #171

layday opened this issue Dec 3, 2021 · 10 comments · Fixed by #174
Assignees
Labels
component:cli CLI components enhancement New feature or request

Comments

@layday
Copy link
Member

layday commented Dec 3, 2021

I ran pip-audit and tabbed away from the terminal. When I tabbed back it said:

$ pip-audit
| Auditing yarl (1.7.2)
No known vulnerabilities found

This confused me, thinking it had only audited yarl, so I re-ran it. This is a fairly minor UX nit, but if there's an easy fix, I think it'd be better to hide the progress text once auditing is finished.

@layday layday added the enhancement New feature or request label Dec 3, 2021
@di
Copy link
Member

di commented Dec 3, 2021

I agree, this was bothering me when I was trying to show examples of pip-audit output.

@woodruffw
Copy link
Member

Thanks for the report! Yeah, we can definitely improve this.

Hiding the spinner/progress entirely might be a little tricky to do with just our current use of the progress package, but we could improve the final text to make it clear that we've performed the entire audit. Something like this, perhaps:

$ pip-audit
| Auditing yarl (1.7.2)
123 packages audited; no known vulnerabilities found

Thoughts?

@woodruffw woodruffw added the component:cli CLI components label Dec 3, 2021
@di
Copy link
Member

di commented Dec 3, 2021

@woodruffw Can't we just do one last spinner "update" with the results?

@woodruffw
Copy link
Member

Can't we just do one last spinner "update" with the results?

Yeah, I think that would work. Are you thinking that we'd remove the current trailing line in that case, or keep it as a duplicate?

@di
Copy link
Member

di commented Dec 3, 2021

Remove it I guess, but that would probably be dependent on the state of --progress-spinner.

@woodruffw
Copy link
Member

Yeah, that's the corner case I was thinking of. I'll play around with it and make some demos with the PR.

@woodruffw woodruffw self-assigned this Dec 3, 2021
@layday
Copy link
Member Author

layday commented Dec 3, 2021

I don't have a lot of experience with manipulating the terminal output and I've not spent very long looking at how progress works, but in AuditSpinner.finalize, instead of calling the spinner's finish method I think that you should be able to:

self.writeln('')  # Replace printed characters with whitespace
self.file.write('\r')  # Reset the cursor
self.file.flush()

@woodruffw
Copy link
Member

Oh, interesting. I had pessimistically assumed that it would be worse than that 😅. I'll test it out.

woodruffw added a commit that referenced this issue Dec 3, 2021
woodruffw added a commit that referenced this issue Dec 3, 2021
* _state: clear the spinner entirely when done

Closes #171.

* CHANGELOG: record changes
@layday
Copy link
Member Author

layday commented Dec 3, 2021

Thanks for the quick fix!

@woodruffw
Copy link
Member

You're welcome; thanks for the report! Let us know if you have any other issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:cli CLI components enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants