代码拉取完成,页面将自动刷新
A helper to generate the READE file automatically.
Install it via hd:
hd i yaml-readme
# yaml-readme -h
Usage:
yaml-readme [flags]
Flags:
-h, --help help for yaml-readme
-p, --pattern string The glob pattern with Golang spec to find files (default "items/*.yaml")
-t, --template string The template file which should follow Golang template spec (default "README.tpl")
Name | Usage |
---|---|
filename |
The filename of a particular item file. For example, items/good.yaml , the filename is good . |
parentname |
The parent directory name. For example, items/good.yaml , the parent name is items . |
fullpath |
The related file path of each items. |
Name | Usage | Description |
---|---|---|
printHelp |
{{printHelp 'hd'}} |
Print the help text of a command |
printToc |
{{printToc}} |
Print the TOC of the template file |
printContributors |
{{printContributors "linuxsuren" "yaml-readme"}} |
Print all the contributors of an repository |
printStarHistory |
{{printStarHistory "linuxsuren" "yaml-readme"}} |
Print the star history of an repository ` |
printVisitorCount |
{{printVisitorCount "repo-id"}} |
Print the visitor count chart of an repository ` |
In case you want to ignore some particular items, you can put a key ignore
with value true
. Let's see the following sample:
name: rick
ignore: true
You could copy the following sample YAML, and change some variables according to your needs.
name: generator
on:
push:
branches: [ master ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'ci skip')"
steps:
- uses: actions/checkout@v3
- name: Update readme
uses: linuxsuren/yaml-readme@v0.0.6
env:
GH_TOKEN: ${{ secrets.GH_SECRETS }}
with:
pattern: 'config/*/*.yml'
username: linuxsuren
org: linuxsuren
repo: hd-home
Below is a simple template sample:
The total number of tools is: {{len .}}
| Name | Latest | Download |
|---|---|---|
{{- range $val := .}}
| {{$val.name}} | {{$val.latest}} | {{$val.download}} |
{{- end}}
Below is a grouped data sample:
{{- range $key, $val := .}}
Year: {{$key}}
| Name | Age |
|---|---|
{{- range $item := $val}}
| {{$item.name}} | {{$item.age}} |
{{- end}}
{{end}}
You could use the following command to render it:
yaml-readme --group-by year
Assume there is a complex YAML like this:
metadata:
annotations:
group/key: 'a value'
then you can use the following template:
{{index $item.metadata.annotations "group/key"}}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。