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

automatically generate screenshots #101

Open
jessebot opened this issue Dec 2, 2023 · 2 comments
Open

automatically generate screenshots #101

jessebot opened this issue Dec 2, 2023 · 2 comments
Assignees
Labels
✨ enhancement New feature request

Comments

@jessebot
Copy link
Collaborator

jessebot commented Dec 2, 2023

Describe the feature you'd like, and why

I'd like a way to automatically generate screenshots for the CLI help, as well as all the TUI screens here:
https://github.com/small-hack/smol-k8s-lab/tree/main/docs/images/screenshots

We can generate the screenshots with rich and textual. We have a hidden feature in smol-k8s-lab for rich here:

and here:

# I use this to print a pretty svg at the end sometimes
if RECORD:
console.save_svg("docs/screenshots/help_text.svg", title="term")

We should expose that via the cli, and also add textual screenshots in there as well, as right now, I actually manually generate each of those screenshots and with the amount of screens we support, this is getting a bit too time consuming.

@jessebot jessebot added the ✨ enhancement New feature request label Dec 2, 2023
@jessebot
Copy link
Collaborator Author

jessebot commented Dec 2, 2023

Ran into a minor snag where the screenshot file name is not predictable, so I've opened Textualize/textual#3795 to kindly ask if this is a feature that can be implemented. In the meantime, I think I can only automate the smol-k8s-lab --help screenshot since rich already provides a way to name the screenshot.

@jessebot jessebot self-assigned this Dec 2, 2023
@jessebot
Copy link
Collaborator Author

jessebot commented Dec 3, 2023

Created an env var to set to generate the --help docs:

RECORD = environ.get("SMOL_SCREENSHOT", False)

davep linked me their useful blog post:
https://blog.davep.org/2023/07/03/making-my-github-banner.html

I've been using it to write a script for our ci jobs:
https://github.com/small-hack/smol-k8s-lab/blob/main/smol_k8s_lab/tui/make_screenshots.py

Also learned about the testing guide 🤯 very useful and makes testing less scary :
https://textual.textualize.io/guide/testing/#snapshot-testing

@jessebot jessebot changed the title Feature Request: automatically generate screenshots automatically generate screenshots Dec 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ enhancement New feature request
Projects
None yet
Development

No branches or pull requests

1 participant