elastic / crd-ref-docs

Generates Kubernetes CRD API reference documentation
Apache License 2.0
103 stars 53 forks source link

[Feature Request] Support for outputting multiple files #59

Closed airycanon closed 8 months ago

airycanon commented 11 months ago

Description

Support for outputting multiple files

Option 1

Add an output-mode command line option, supported values: single | multiple

Example

single mode
$ crd-ref-docs --source-path=./pkg/apis \
    --config=config.yaml \
    --renderer=markdown \
    --output-path ./output \
    --output-mode=single

$ tree output
output
└── out.md

1 directory, 1 file
multiple mode
$ crd-ref-docs --source-path=./pkg/apis \
    --config=config.yaml \
    --renderer=markdown \
    --output-path ./output \
    --output-mode=multiple

$ tree output 
output
├── <group one>.md
└── <group two>.md

1 directory, 2 files

Option 2

Add an output-mode command line option, supported values: single | group | group-version

Example

single mode
$ crd-ref-docs --source-path=./pkg/apis \
    --config=config.yaml \
    --renderer=markdown \
    --output-path ./output \
    --output-mode=single

$ tree output
output
└── out.md

1 directory, 1 file
group mode
$ crd-ref-docs --source-path=./pkg/apis \
    --config=config.yaml \
    --renderer=markdown \
    --output-path ./output \
    --output-mode=group

$ tree output 
output
├── <group one>.md
└── <group two>.md

1 directory, 2 files
group-version mode
$ crd-ref-docs --source-path=./pkg/apis \
    --config=config.yaml \
    --renderer=markdown \
    --output-path ./output \
    --output-mode=group-version

$ tree output 
output
├── <group one>/v1alpha1.md
├── <group one>/v1beta1.md
└── <group two>/v1alpha1.md

1 directory, 3 files