@@ -10,10 +10,11 @@ COLOR_PREFIX="\e[32m"
1010COLOR_ERROR=" \e[31m"
1111COLOR_RESET=" \e[0m"
1212
13- USAGE=" $( basename " ${0} " ) path/to/scanner/Chart.yaml path/to/.helm-docs"
13+ USAGE=" $( basename " ${0} " ) --scanner path/to/scanner/Chart.yaml path/to/.helm-docs"
1414
15- CHART_FILE=" ${1:- } "
16- HELM_DOCS_DIR=" ${2:- } "
15+ DOC_TYPE=" ${1:- } "
16+ CHART_FILE=" ${2:- } "
17+ HELM_DOCS_DIR=" ${3:- } "
1718
1819function log() {
1920 echo -e " ${COLOR_PREFIX} SCB${COLOR_RESET} ${1} "
@@ -23,14 +24,20 @@ function error() {
2324 log >&2 " ${COLOR_ERROR} ERROR${COLOR_RESET} : ${1} "
2425}
2526
27+ if [[ -z " ${DOC_TYPE} " ]]; then
28+ error " No doc type given as first parameter!"
29+ error " ${USAGE} "
30+ exit 1
31+ fi
32+
2633if [[ -z " ${CHART_FILE} " ]]; then
27- error " No chart file file given as first parameter!"
34+ error " No chart file given as second parameter!"
2835 error " ${USAGE} "
2936 exit 1
3037fi
3138
3239if [[ -z " ${HELM_DOCS_DIR} " ]]; then
33- error " No helm docs dir given as second parameter!"
40+ error " No helm docs dir given as third parameter!"
3441 error " ${USAGE} "
3542 exit 1
3643fi
@@ -52,8 +59,8 @@ function generate_docs() {
5259 --template-files=" ${dockerhub_template} "
5360}
5461
55- function main () {
56- log " Generating docs for ${CHART_FILE} ..."
62+ function generate_scanner_docs () {
63+ log " Generating scanner docs for ${CHART_FILE} ..."
5764
5865 local scanner_dir docs_dir parser_dir scanner_image_dir
5966
@@ -99,4 +106,16 @@ function main() {
99106 " ${HELM_DOCS_DIR} /README.ArtifactHub.md.gotmpl"
100107}
101108
109+ function main() {
110+ case " ${DOC_TYPE} " in
111+ " --scanner" )
112+ generate_scanner_docs
113+ ;;
114+ * )
115+ error " Unsupported doc type: ${DOC_TYPE} !"
116+ error " ${USAGE} "
117+ ;;
118+ esac
119+ }
120+
102121main
0 commit comments