Add make readme to generate and update the readme's --help text#2047
Add make readme to generate and update the readme's --help text#2047katrinafyi wants to merge 4 commits intolycheeverse:masterfrom
make readme to generate and update the readme's --help text#2047Conversation
scripts/update_readme.py
Outdated
| new_help = '\n'.join( | ||
| line.replace(f'lychee/{version}', 'lychee/x.y.z').rstrip() | ||
| for line in new_help.strip().split('\n') | ||
| ) |
There was a problem hiding this comment.
I find this a bit hard to read. Can we split it up into multiple steps?
lines = help_output.strip().splitlines()
normalized = [
line.rstrip().replace(f"lychee/{version}", "lychee/x.y.z")
for line in lines
]
new_help = "\n".join(normalized)|
Thanks, lgtm. I want to mention that by merging this we would take on a dependency to Python. Might not be a big deal, given that every major OS ships it by default and it's also in GitHub actions, but the rest of the maintenance scripts are written in bash so far. Not saying that we should rewrite it in bash. I actually tried and it looked awful. 😆 So, just an observation. |
|
I've just pushed two commits to simplify it a bit, let me know what you think. Re using Python, yeah it's true. But it's only a dev dependency and even then, it's only needed if the developer wants this convenience - you can always copy paste. For fun, I had a go at writing it in sed and it was also less readable :") sed '
/^```help-message$/,/^```$/ {
/^```help-message$/ {
r help.txt
n
}
/^```$/ n
d
}
' README.md |
mre
left a comment
There was a problem hiding this comment.
This looks great. Thanks for the simplifications.
Shall we add a test to see if it works? And I'm actually wondering if we should make that part of the release pipeline.
But these are just ideas. We can also just merge it as is and come back to that later (or not at all)
|
Hmm, just thinking how it might interact with the existing unit test. Maybe there could be a ci task that generates the readme and pushes it, then we don't need the unit test and the developer doesn't have to think about it at all. WDYT |
|
Yeah, that would be cool. Maybe we should keep the changes minimal for now? We could do that in a separate PR? |
|
Yeah a separate PR sounds good |
After #2007, the options.rs help text would have
///in front of each line making it harder to copy.