Skip to content

Add make readme to generate and update the readme's --help text#2047

Open
katrinafyi wants to merge 4 commits intolycheeverse:masterfrom
rina-forks:make-readme
Open

Add make readme to generate and update the readme's --help text#2047
katrinafyi wants to merge 4 commits intolycheeverse:masterfrom
rina-forks:make-readme

Conversation

@katrinafyi
Copy link
Member

After #2007, the options.rs help text would have /// in front of each line making it harder to copy.

Comment on lines 12 to 15
new_help = '\n'.join(
line.replace(f'lychee/{version}', 'lychee/x.y.z').rstrip()
for line in new_help.strip().split('\n')
)
Copy link
Member

Choose a reason for hiding this comment

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

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)

@mre
Copy link
Member

mre commented Feb 16, 2026

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.

@katrinafyi
Copy link
Member Author

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

Copy link
Member

@mre mre left a comment

Choose a reason for hiding this comment

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

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)

@katrinafyi
Copy link
Member Author

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

@mre
Copy link
Member

mre commented Feb 19, 2026

Yeah, that would be cool. Maybe we should keep the changes minimal for now? We could do that in a separate PR?

@katrinafyi
Copy link
Member Author

Yeah a separate PR sounds good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments