Very small CLI based on spf13/cobra
to generate README.md
from existing GitLab components.
The genreated README.md
can be expanded using a header and footer file. By default those are
HEADER.md
and FOOTER.md
in the project directory.
The same goes for each component, if the component is in it's own directory within templates/
.
For components that only consist of a file (eg. templates/component-name.yaml
), no header or footer
files will be used.
The following fields on each input are supported
description
default
options
type
regex
The following spec
in a component
spec:
inputs:
job-prefix: # Mandatory string input
description: |
Define a prefix for the job name.
Now with line break support
job-stage: # Optional string input with a default value when not provided
default: test
environment: # Mandatory input that must match one of the options
options: ['test', 'staging', 'production']
concurrency:
type: number # Optional numeric input with a default value when not provided
default: 1
version: # Mandatory string input that must match the regular expression
type: string
regex: /^v\d\.\d+(\.\d+)$/
export_results: # Optional boolean input with a default value when not provided
type: boolean
default: true
Will result in the following markdown
| Input / Variable | Description | Default value | Type | Options | Regex |
| ---------------- | ----------- | ------------- | ------- | ------- | ----- |
| `concurrency` | | _1_ | number | __ | `` |
| `environment` | | __ | | _test, staging, production_ | `` |
| `export_results` | | _true_ | boolean | __ | `` |
| `job-prefix` | Define a prefix for the job name.<br>Now with line break support | __ | | __ | `` |
| `job-stage` | | _test_ | | __ | `` |
| `version` | | __ | string | __ | `/^v\d\.\d+(\.\d+)$/` |
Input / Variable | Description | Default value | Type | Options | Regex |
---|---|---|---|---|---|
concurrency |
1 | number | __ | `` | |
environment |
__ | test, staging, production | `` | ||
export_results |
true | boolean | __ | `` | |
job-prefix |
Define a prefix for the job name Now with line break support |
__ | __ | `` | |
job-stage |
test | __ | `` | ||
version |
__ | string | __ | /^v\d\.\d+(\.\d+)$/ |
The generator can also be used as a .pre-commit-hook
to verify that the README.md
was
updated on each commit.
repos:
- repo: https://github.com/peschmae/glab-component-generator
rev: 0.7.0
hooks:
- id: glab-component-readme
args:
- --header=docs/HEADER.md
- --footer=docs/FOOTER.md