Skip to content

Commit a3a0299

Browse files
committed
Escape braces in CLI documentation when generating markdown
Using {{ term }} in markdown causes issues for vitepress. As a result, we have to escape these characters when generating cli-reference.md from the CLI help pages. Signed-off-by: Angel Misevski <[email protected]>
1 parent 5c78993 commit a3a0299

File tree

4 files changed

+62
-59
lines changed

4 files changed

+62
-59
lines changed

docs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@
2323
"cheerio": "1.0.0",
2424
"vue3-marquee": "^4.2.2"
2525
},
26-
"packageManager": "pnpm@10.0.0"
26+
"packageManager": "pnpm@10.12.4"
2727
}

docs/src/docs/cli/cli-reference.md

Lines changed: 53 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -8,49 +8,6 @@ import VersionInfo from '@theme/components/VersionInfo.vue'
88
</script>
99

1010
<VersionInfo />
11-
## kit cache
12-
13-
Manage temporary files cached by Kit
14-
15-
### Synopsis
16-
17-
Manage files stored in the temporary KitOps cache dir ($KITOPS_HOME/cache)
18-
19-
Normally, this directory is empty, but may contain leftover files from resumable
20-
downloads or files that were not cleaned up due to the command being cancelled.
21-
22-
The $KITOPS_HOME location is system dependent:
23-
- Linux: $XDG_DATA_HOME/kitops with a fall back to $HOME/.local/share/kitops
24-
- MacOS: ~/Library/Caches/kitops
25-
- Windows: %LOCALAPPDATA%\kitops
26-
27-
28-
### Examples
29-
30-
```
31-
# Get information about size of cached files
32-
kit cache info
33-
34-
# Clear files in cache
35-
kit cache clear
36-
37-
```
38-
39-
### Options
40-
41-
```
42-
-h, --help help for cache
43-
```
44-
45-
### Options inherited from parent commands
46-
47-
```
48-
--config string Alternate path to root storage directory for CLI
49-
--log-level string Log messages above specified level ('trace', 'debug', 'info', 'warn', 'error') (default 'info') (default "info")
50-
--progress string Configure progress bars for longer operations (options: none, plain, fancy) (default "plain")
51-
-v, --verbose count Increase verbosity of output (use -vv for more)
52-
```
53-
5411
## kit cache clear
5512

5613
Clear temporary cache storage
@@ -105,24 +62,37 @@ kit cache info [flags]
10562
-v, --verbose count Increase verbosity of output (use -vv for more)
10663
```
10764

108-
## kit dev
65+
## kit cache
10966

110-
Run models locally (experimental)
67+
Manage temporary files cached by Kit
11168

11269
### Synopsis
11370

114-
Start a local server and interact with a model in the browser
71+
Manage files stored in the temporary KitOps cache dir ($KITOPS_HOME/cache)
72+
73+
Normally, this directory is empty, but may contain leftover files from resumable
74+
downloads or files that were not cleaned up due to the command being cancelled.
75+
76+
The $KITOPS_HOME location is system dependent:
77+
- Linux: $XDG_DATA_HOME/kitops with a fall back to $HOME/.local/share/kitops
78+
- MacOS: ~/Library/Caches/kitops
79+
- Windows: %LOCALAPPDATA%\kitops
80+
11581

11682
### Examples
11783

11884
```
119-
kit dev start
85+
# Get information about size of cached files
86+
kit cache info
87+
88+
# Clear files in cache
89+
kit cache clear
12090
```
12191

12292
### Options
12393

12494
```
125-
-h, --help help for dev
95+
-h, --help help for cache
12696
```
12797

12898
### Options inherited from parent commands
@@ -236,6 +206,35 @@ kit dev stop [flags]
236206
-v, --verbose count Increase verbosity of output (use -vv for more)
237207
```
238208

209+
## kit dev
210+
211+
Run models locally (experimental)
212+
213+
### Synopsis
214+
215+
Start a local server and interact with a model in the browser
216+
217+
### Examples
218+
219+
```
220+
kit dev start
221+
```
222+
223+
### Options
224+
225+
```
226+
-h, --help help for dev
227+
```
228+
229+
### Options inherited from parent commands
230+
231+
```
232+
--config string Alternate path to root storage directory for CLI
233+
--log-level string Log messages above specified level ('trace', 'debug', 'info', 'warn', 'error') (default 'info') (default "info")
234+
--progress string Configure progress bars for longer operations (options: none, plain, fancy) (default "plain")
235+
-v, --verbose count Increase verbosity of output (use -vv for more)
236+
```
237+
239238
## kit diff
240239

241240
Compare two ModelKits
@@ -538,12 +537,12 @@ listed modelkit.
538537

539538
Template placeholders:
540539

541-
{{ .Repo }} - repository name
542-
{{ .Tags }} - slice of tags for the modelkit
543-
{{ .Digest }} - digest of the modelkit
544-
{{ .ModelName }} - name defined in the Kitfile
545-
{{ .Size }} - total size of the modelkit
546-
{{ .Author }} - author from the Kitfile
540+
<code v-pre>{{ .Repo }}</code> - repository name
541+
<code v-pre>{{ .Tags }}</code> - slice of tags for the modelkit
542+
<code v-pre>{{ .Digest }}</code> - digest of the modelkit
543+
<code v-pre>{{ .ModelName }}</code> - name defined in the Kitfile
544+
<code v-pre>{{ .Size }}</code> - total size of the modelkit
545+
<code v-pre>{{ .Author }}</code> - author from the Kitfile
547546

548547
```
549548
kit list [flags] [REPOSITORY]

docs/src/docs/cli/generate.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,9 @@ for file in $(find "$DOCS_DIR/" -name "kit_*.md" | sort); do
2525
sed -n '/### SEE ALSO/q;p' "$file" >> $DOCS_DIR/cli-reference.md
2626
done
2727

28+
# Escape and {{ sections }}: see: https://github.com/vuejs/vitepress/discussions/480
29+
sed -i.bak 's|\({{[^}]*}}\)|<code v-pre>\1</code>|g' "$DOCS_DIR/cli-reference.md"
30+
rm -f "$DOCS_DIR/cli-reference.md.bak"
31+
2832
# Remove generated files, keeping only the combined CLI reference doc
2933
rm -rf $DOCS_DIR/kit*.md

pkg/cmd/kitcache/cmd.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@ package kitcache
1818

1919
import (
2020
"fmt"
21-
fscache "github.com/kitops-ml/kitops/pkg/lib/filesystem/cache"
22-
"github.com/kitops-ml/kitops/pkg/output"
2321
"io"
2422
"sort"
2523
"text/tabwriter"
2624

25+
fscache "github.com/kitops-ml/kitops/pkg/lib/filesystem/cache"
26+
"github.com/kitops-ml/kitops/pkg/output"
27+
2728
"github.com/spf13/cobra"
2829
)
2930

@@ -45,8 +46,7 @@ The $KITOPS_HOME location is system dependent:
4546
kit cache info
4647
4748
# Clear files in cache
48-
kit cache clear
49-
`,
49+
kit cache clear`,
5050
}
5151
cmd.AddCommand(cacheInfoCommand())
5252
cmd.AddCommand(cacheClearCommand())

0 commit comments

Comments
 (0)