Skip to content

Commit c037be2

Browse files
authored
Update cli docs generation script (#1535)
1 parent d64c756 commit c037be2

File tree

4 files changed

+25
-13
lines changed

4 files changed

+25
-13
lines changed

dev/cli_md_template.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,18 @@ pip install cortex
1010

1111
## Install the CLI without Python Client
1212

13+
### Mac/Linux OS
14+
1315
```bash
1416
# Replace `INSERT_CORTEX_VERSION` with the complete CLI version (e.g. 0.18.1):
1517
$ bash -c "$(curl -sS https://raw.githubusercontent.com/cortexlabs/cortex/vINSERT_CORTEX_VERSION/get-cli.sh)"
1618

17-
# For example to download CLI version 0.18.1 (Note the 'v'):
19+
# For example to download CLI version 0.18.1 (Note the "v"):
1820
$ bash -c "$(curl -sS https://raw.githubusercontent.com/cortexlabs/cortex/v0.18.1/get-cli.sh)"
1921
```
22+
23+
### Windows
24+
25+
To install the Cortex CLI on a Windows machine, follow [this guide](../guides/windows-cli.md).
26+
27+
## Command overview

dev/generate_cli_md.sh

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,18 @@ set -e
1818

1919
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")"/.. >/dev/null && pwd)"
2020

21-
cat $ROOT/dev/cli_md_template.md
21+
out_file=$ROOT/docs/miscellaneous/cli.md
22+
rm -f $out_file
2223

24+
echo "building cli..."
2325
make --no-print-directory -C $ROOT cli
24-
echo
2526

2627
# Clear default environments
2728
cli_config_backup_path=$HOME/.cortex/cli-bak-$RANDOM.yaml
2829
mv $HOME/.cortex/cli.yaml $cli_config_backup_path
2930

31+
cat $ROOT/dev/cli_md_template.md >> $out_file
32+
3033
commands=(
3134
"deploy"
3235
"get"
@@ -47,17 +50,18 @@ commands=(
4750
"completion"
4851
)
4952

50-
echo "## Command overview"
51-
echo
53+
echo "running help commands..."
5254

5355
for cmd in "${commands[@]}"; do
54-
echo "### ${cmd}"
55-
echo
56-
echo -n '```text'
57-
$ROOT/bin/cortex help ${cmd}
58-
echo '```'
59-
echo
56+
echo '' >> $out_file
57+
echo "### ${cmd}" >> $out_file
58+
echo '' >> $out_file
59+
echo -n '```text' >> $out_file
60+
$ROOT/bin/cortex help ${cmd} >> $out_file
61+
echo '```' >> $out_file
6062
done
6163

6264
# Bring back CLI config
6365
mv -f $cli_config_backup_path $HOME/.cortex/cli.yaml
66+
67+
echo "updated $out_file"

docs/guides/windows-cli.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pip install cortex
4242
# Replace `INSERT_CORTEX_VERSION` with the complete CLI version (e.g. 0.18.1):
4343
$ bash -c "$(curl -sS https://raw.githubusercontent.com/cortexlabs/cortex/vINSERT_CORTEX_VERSION/get-cli.sh)"
4444

45-
# For example to download CLI version 0.18.1 (Note the 'v'):
45+
# For example to download CLI version 0.18.1 (Note the "v"):
4646
$ bash -c "$(curl -sS https://raw.githubusercontent.com/cortexlabs/cortex/v0.18.1/get-cli.sh)"
4747
```
4848

docs/miscellaneous/cli.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pip install cortex
1616
# Replace `INSERT_CORTEX_VERSION` with the complete CLI version (e.g. 0.18.1):
1717
$ bash -c "$(curl -sS https://raw.githubusercontent.com/cortexlabs/cortex/vINSERT_CORTEX_VERSION/get-cli.sh)"
1818

19-
# For example to download CLI version 0.18.1 (Note the 'v'):
19+
# For example to download CLI version 0.18.1 (Note the "v"):
2020
$ bash -c "$(curl -sS https://raw.githubusercontent.com/cortexlabs/cortex/v0.18.1/get-cli.sh)"
2121
```
2222

0 commit comments

Comments
 (0)