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

README.md templating #3

Closed
1 of 3 tasks
sc250024 opened this issue Jul 9, 2019 · 6 comments
Closed
1 of 3 tasks

README.md templating #3

sc250024 opened this issue Jul 9, 2019 · 6 comments
Labels
enhancement New feature or request

Comments

@sc250024
Copy link
Contributor

sc250024 commented Jul 9, 2019

First off, let me say this is an awesome project! This saves so much time, so thank you for doing it!

  • I'm submitting a ...

    • bug report
    • feature request
    • support request => Please do not submit support request here, see note at the top of this template.
  • Do you want to request a feature or report a bug?

This is a feature request to have the CLI read from a README.md.tpl. The idea is that the user can then write some custom text for their README.md file, while also keeping the nice autogenerated Helm name, description, and variables.

It would be nice if the CLI could read from a file README.md.tpl, which is defined by the user, specified in a command line flag. That way, something like the following could be done:

README.md.tpl

{{ block "chart_name" }}

{{ block "chart_description" }}

# My custom section 1
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis non semper purus, et aliquet mauris. Quisque ligula metus, semper maximus faucibus eu, venenatis et augue. Aenean eget dapibus mi. Mauris sed nibh sit amet nibh scelerisque convallis vitae et nisl. Aliquam vulputate dolor et vehicula venenatis. Sed quis nisi a massa venenatis aliquet. Maecenas sit amet lorem ipsum. Proin iaculis justo et dolor viverra, eu consequat ex pellentesque. Etiam rhoncus, nisl nec egestas pretium, massa magna tristique metus, eu euismod erat lacus non nisi. Donec quis rhoncus sapien. Praesent at venenatis tellus. Integer cursus nec massa quis scelerisque. Nam luctus urna vitae gravida viverra. Nunc mi turpis, tincidunt id condimentum sed, egestas et magna. Nam id gravida est. Integer ultricies dapibus quam nec commodo.

## My custom subsection

Praesent at venenatis tellus. Integer cursus nec massa quis scelerisque. Nam luctus urna vitae gravida viverra. Nunc mi turpis, tincidunt id condimentum sed, egestas et magna. Nam id gravida est. Integer ultricies dapibus quam nec commodo.

> ```yaml
> some:
>   important:
>     example:
>       foo: bar
> ```

{{ block "chart_variables" }}

The helm-docs CLI would then populate the chart_name, chart_description, and chart_variables configuration blocks from chart specifications. The custom text in the middle (or wherever the user chooses) will be kept, resulting in a more complete README.md file for Helm charts.

The command might be helm-docs --template README.me.tpl, and the template file would follow the Golang specification.

  • What is the current behavior?

Currently, the README.md file is written from the helm-docs command reading only the Chart.yaml file.

@norwoodj
Copy link
Owner

norwoodj commented Jul 9, 2019

Hi Scott!

Yes, I have been wanting to allow for users to put some amount of custom content into the README for a while, but couldn't find the right abstraction for making that happen. I think this is a wonderful idea, especially if we maintain backwards compatibility by implementing the following rules:

  • If no README.md.gotpl (or other file specified with --template) file is found, default to the existing rules for generation
  • Otherwise, render the README.md file (or other output file specified with a new --output flag)

I don't have time to do this work immediately, but would be happy to review a pull request, or get on it in the coming weeks.

@norwoodj norwoodj added the enhancement New feature or request label Jul 9, 2019
@sc250024
Copy link
Contributor Author

@norwoodj Maybe I can help? What have you looked into thus far? I know there is a tool called confd (https://github.com/kelseyhightower/confd) that I used previously. It was for a different purpose, but case in point, it did file templating, and is written in Go as well.

@norwoodj
Copy link
Owner

I have a good idea of how it would be implemented, just lacking the time to do it at present. I made some updates to the project yesterday to at least make further extension easier, but I probably won't have the time to implement the templating functionality for a week or two.

norwoodj added a commit that referenced this issue Jul 17, 2019
norwoodj added a commit that referenced this issue Jul 17, 2019
norwoodj added a commit that referenced this issue Jul 17, 2019
norwoodj added a commit that referenced this issue Jul 17, 2019
@norwoodj
Copy link
Owner

@sc250024 I've implemented this feature and updated the documentation to reflect the changed behaviour. Please let me know when you get a chance to test this out if there's anything confusing, or if things don't work the way you expect. Thanks for the suggestion!

@sc250024
Copy link
Contributor Author

@norwoodj Thank you so much ! I tested out the README.md rendering with our CI pipeline, and it works great. Kudos for all the hard work :)

norwoodj pushed a commit that referenced this issue May 22, 2020
@DivyaSundar-89
Copy link

Hello,

Firstly, this is a great tool. Wanted to understand a couple of things if they are supported.

  1. We have a requirement of helm of helms where we have multiple charts as dependencies in a single chart. Can I use this tool to generate single README file with values from all the dependent charts ?
  2. Is it possible to run this tool against a tar.gz file or is it necessary to explode the chart directory to run the helm-docs tool ?

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

No branches or pull requests

3 participants