Skip to content

Commit 4797a4f

Browse files
committed
added pandoc
1 parent be7b4ab commit 4797a4f

File tree

4 files changed

+58
-25
lines changed

4 files changed

+58
-25
lines changed

.github/workflows/test-e2e.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,12 @@ jobs:
2020
with:
2121
go-version-file: go.mod
2222

23+
- name: Install Pandoc
24+
run: sudo apt-get install pandoc
25+
2326
- name: Validate
2427
run: make validate
28+
2529
tests-e2e:
2630
runs-on: ubuntu-latest
2731
needs: validate

.github/workflows/test.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ jobs:
3737
with:
3838
go-version-file: go.mod
3939

40+
- name: Install Pandoc
41+
run: sudo apt-get install pandoc
42+
4043
- name: Validate
4144
run: make validate
4245

docs/cli/k3kcli.adoc

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,23 @@ CLI for K3K.
1010
--kubeconfig string kubeconfig path ($HOME/.kube/config or $KUBECONFIG if set)
1111
----
1212

13+
== k3kcli cluster
14+
15+
K3k cluster command.
16+
17+
=== Options
18+
19+
----
20+
-h, --help help for cluster
21+
----
22+
23+
=== Options inherited from parent commands
24+
25+
----
26+
--debug Turn on debug logs
27+
--kubeconfig string kubeconfig path ($HOME/.kube/config or $KUBECONFIG if set)
28+
----
29+
1330
== k3kcli cluster create
1431

1532
Create a new cluster.
@@ -116,14 +133,14 @@ k3kcli cluster list [command options]
116133
--kubeconfig string kubeconfig path ($HOME/.kube/config or $KUBECONFIG if set)
117134
----
118135

119-
== k3kcli cluster
136+
== k3kcli kubeconfig
120137

121-
K3k cluster command.
138+
Manage kubeconfig for clusters.
122139

123140
=== Options
124141

125142
----
126-
-h, --help help for cluster
143+
-h, --help help for kubeconfig
127144
----
128145

129146
=== Options inherited from parent commands
@@ -162,14 +179,14 @@ k3kcli kubeconfig generate [flags]
162179
--kubeconfig string kubeconfig path ($HOME/.kube/config or $KUBECONFIG if set)
163180
----
164181

165-
== k3kcli kubeconfig
182+
== k3kcli policy
166183

167-
Manage kubeconfig for clusters.
184+
K3k policy command.
168185

169186
=== Options
170187

171188
----
172-
-h, --help help for kubeconfig
189+
-h, --help help for policy
173190
----
174191

175192
=== Options inherited from parent commands
@@ -264,20 +281,3 @@ k3kcli policy list [command options]
264281
--debug Turn on debug logs
265282
--kubeconfig string kubeconfig path ($HOME/.kube/config or $KUBECONFIG if set)
266283
----
267-
268-
== k3kcli policy
269-
270-
K3k policy command.
271-
272-
=== Options
273-
274-
----
275-
-h, --help help for policy
276-
----
277-
278-
=== Options inherited from parent commands
279-
280-
----
281-
--debug Turn on debug logs
282-
--kubeconfig string kubeconfig path ($HOME/.kube/config or $KUBECONFIG if set)
283-
----

scripts/generate-cli-docs

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,39 @@ set -eou pipefail
44

55
DOCS_DIR=./docs/cli
66

7-
7+
# Generate the raw markdown files
88
go run $DOCS_DIR/genclidoc.go
99

1010
echo "Converting Markdown documentation to asciidoc"
1111

1212
pandoc --from markdown --to asciidoc --lua-filter=$DOCS_DIR/convert.lua $DOCS_DIR/k3kcli.md > $DOCS_DIR/k3kcli.adoc
1313
echo "" >> $DOCS_DIR/k3kcli.adoc
14-
pandoc --from markdown --to asciidoc --lua-filter=$DOCS_DIR/convert.lua $DOCS_DIR/k3kcli_*.md >> $DOCS_DIR/k3kcli.adoc
14+
15+
# We use an explicit list of files to keep a stable ordering
16+
SUBCOMMAND_FILES=(
17+
"$DOCS_DIR/k3kcli_cluster.md"
18+
"$DOCS_DIR/k3kcli_cluster_create.md"
19+
"$DOCS_DIR/k3kcli_cluster_delete.md"
20+
"$DOCS_DIR/k3kcli_cluster_list.md"
21+
"$DOCS_DIR/k3kcli_kubeconfig.md"
22+
"$DOCS_DIR/k3kcli_kubeconfig_generate.md"
23+
"$DOCS_DIR/k3kcli_policy.md"
24+
"$DOCS_DIR/k3kcli_policy_create.md"
25+
"$DOCS_DIR/k3kcli_policy_delete.md"
26+
"$DOCS_DIR/k3kcli_policy_list.md"
27+
)
28+
29+
# Check for newly added doc files
30+
EXPECTED_COUNT=${#SUBCOMMAND_FILES[@]}
31+
ACTUAL_COUNT=$(ls -1 $DOCS_DIR/k3kcli_*.md | wc -l)
32+
33+
if [ "$EXPECTED_COUNT" -ne "$ACTUAL_COUNT" ]; then
34+
echo "ERROR: File count mismatch!"
35+
echo "Expected $EXPECTED_COUNT files in the array, but found $ACTUAL_COUNT on disk."
36+
echo "Please update the SUBCOMMAND_FILES array in $0"
37+
exit 1
38+
fi
39+
40+
pandoc --from markdown --to asciidoc --lua-filter=$DOCS_DIR/convert.lua "${SUBCOMMAND_FILES[@]}">> $DOCS_DIR/k3kcli.adoc
1541

1642
echo "Asciidoc documentation generated at $DOCS_DIR/k3kcli.adoc"

0 commit comments

Comments
 (0)