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

Generate Config.md from JSON schema #3441

Closed
stefanhaller opened this issue Mar 27, 2024 · 3 comments
Closed

Generate Config.md from JSON schema #3441

stefanhaller opened this issue Mar 27, 2024 · 3 comments
Labels

Comments

@stefanhaller
Copy link
Collaborator

The "Default" documentation in Config.md is out of date in several ways; we keep forgetting to add new keybindings, for example. (We have a checkbox in the PR template for that, but it doesn't seem to help enough.)

We should look into auto-generating that section from JSON schema to prevent it from getting out of date.

I had a very cursory look, and there seem to be tons of tools out there that can generate documentation (HTML or Markdown) from JSON schema; however, I haven't found one that produces output similar to what we have right now. Most of these tools are meant for API documentation, so they generate big tables with lots of detail that's not relevant for us. Some of these have a template feature though, so maybe this could be used to customize the output. I haven't looked closer at that yet. In the worst case we'd implement one ourselves, which doesn't seem super hard either since our schema is fairly simple.

Unfortunately we won't be able to make this a go generate thing, because I don't see a way to cascade generators, or define dependencies between them. We already have a generator for the schema, and that one will have to run first; this new one would then work on the output of the first one. I don't see how that's possible in go, so we'll have to make this a custom script.

@stefanhaller
Copy link
Collaborator Author

@karimkhaleel Since you did the great work on the schema generation and have some experience with the topic, would you be interested in looking into this?

@karimkhaleel
Copy link
Contributor

Yeah, this seems interesting. I'll take a look. Thanks for the callout!

stefanhaller added a commit that referenced this issue May 19, 2024
…3565)

- **PR Description**
This uses the JSON schema generated in
#3039 to generate and
replace the default lazygit config in Config.md when running `go
generate ./...`

Relevant issue: #3441

The generated config contains all the entries that have default values
set in `user_config.go`
@stefanhaller
Copy link
Collaborator Author

Fixed by #3565.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants