Skip to content

cli(script): gen screenshot for cli helps #1048

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

Merged

Conversation

Ellie-Yen
Copy link
Contributor

@Ellie-Yen Ellie-Yen commented Apr 1, 2024

Description

Add a script to generate screenshot of all cli help contents.

Checklist

  • Add test cases to all the changes you introduce
  • Run ./scripts/format and ./scripts/test locally to ensure this change passes linter check and test
  • Test the changes on the local machine manually
  • Update the documentation for the changes

Expected behavior

Execute scripts/gen_cli_help_screenshots.py will generate screenshots of cli help instructions

Steps to Test This Pull Request

  1. Execute scripts/gen_cli_help_screenshots.py
  2. Check each of content insides commitizen.cli's data is match its screenshot in docs/images/cli_help/ folder.

Additional context

Considering the purpose of the file is more closed to a script, put it into scripts folder.
Should add test and update the documentation accordinately after the change is accepted.

Copy link

codecov bot commented Apr 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.48%. Comparing base (120d514) to head (cba2c06).
Report is 255 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1048      +/-   ##
==========================================
+ Coverage   97.33%   97.48%   +0.15%     
==========================================
  Files          42       55      +13     
  Lines        2104     2429     +325     
==========================================
+ Hits         2048     2368     +320     
- Misses         56       61       +5     
Flag Coverage Δ
unittests 97.48% <ø> (+0.15%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@woile
Copy link
Member

woile commented Apr 2, 2024

This looks super cool, do you think it's possible to generate animated gifs as well?

Copy link
Member

@Lee-W Lee-W left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Ellie-Yen , thank you for your immediate PR! This looks promising! But there are a few things I will need your help with before we can merge it.

  1. address the comments we have in separate files
  2. reword the commit messages into ci instead of feat as they're not commitizen features but more like a documentation improvement

After we merge this one, there are a few steps we want to do

  1. Add these images to the document (somewhere like https://commitizen-tools.github.io/commitizen/init/)
  2. Automate the update images scripts in github actions

Thanks again for this cool script

@Ellie-Yen Ellie-Yen force-pushed the fea/gen-cli-help-screenshots branch from 57790bd to c1c2711 Compare April 4, 2024 06:32
@Ellie-Yen Ellie-Yen changed the title feat(script): gen screenshot for cli helps cli(script): gen screenshot for cli helps Apr 4, 2024
Copy link
Member

@Lee-W Lee-W left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the prompt update! We're really close to merging.

"""Generate the screenshot for help message on each cli command and save them as svg files."""
if not os.path.exists(images_root):
os.makedirs(images_root)
print(f'created {images_root}')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
print(f'created {images_root}')
print(f"Created {images_root}")

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can run ruff or black against these files to improve style consistency

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay. I run ruff fomat on this file and its style is consistent now.
Btw, I notice only commitizen and tests are included in the scripts/format as below.
Do you think including scripts and other folders is a good idea ?

image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, I think that what we should do

@Ellie-Yen Ellie-Yen force-pushed the fea/gen-cli-help-screenshots branch from 6fd16eb to cba2c06 Compare April 5, 2024 05:22
@Lee-W Lee-W added pr-status: ready-to-merge almost ready to merge. just keep it for a few days for others to check and removed pr-status: wait-for-review pr-status: wait-for-modification labels Apr 5, 2024
@Lee-W Lee-W requested a review from woile April 5, 2024 14:58
@Lee-W
Copy link
Member

Lee-W commented Apr 5, 2024

@Ellie-Yen Great job! I think we're good to merge this one, but I'll keep it open for a few days so that others can take a look. btw are you interested in finishing these
#1048 (review)

@woile @noirbizarre I'm planning on merging this one these days. Let me know if you have any thoughts. Thanks!

@Lee-W
Copy link
Member

Lee-W commented Apr 6, 2024

This looks super cool, do you think it's possible to generate animated gifs as well?

We could make it a future improvement 👍
These help texts might not be as useful. but for demonstrating the interactive TUI, it could be really helpful. I'm thinking of using https://docs.asciinema.org/

@Lee-W Lee-W merged commit 9d6c087 into commitizen-tools:master Apr 7, 2024
18 checks passed
@Ellie-Yen
Copy link
Contributor Author

Thanks for reviewing ~
I'll try https://docs.asciinema.org/ soon and let's see if it could get better !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-status: ready-to-merge almost ready to merge. just keep it for a few days for others to check
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants