Skip to content

Commit ac8360f

Browse files
committed
chore: update CLI documentation and Helm commands in package.json
- Modified the `docs:cli` command in `package.json` to reflect the new script location. - Updated README to include a new section for global help and improved command usage descriptions for better clarity.
1 parent 87cba52 commit ac8360f

File tree

3 files changed

+56
-2
lines changed

3 files changed

+56
-2
lines changed

README.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ Generate node identities, configure consensus, and emit a Besu genesis.
44

55
## CLI usage
66

7-
```
7+
### Global Help
8+
9+
```text
810
Usage: network-bootstrapper [options] [command]
911
1012
Utilities for configuring Besu-based networks.
@@ -18,8 +20,11 @@ Commands:
1820
compile-genesis [options] Merge per-account allocation ConfigMaps into a Besu
1921
genesis file.
2022
help [command] display help for command
23+
```
2124

25+
### generate
2226

27+
```text
2328
Usage: network-bootstrapper generate [options]
2429
2530
Generate node identities, configure consensus, and emit a Besu genesis.
@@ -46,5 +51,19 @@ Options:
4651
--contract-size-limit <number> Contract size limit in bytes. (default: 2147483647)
4752
--accept-defaults Accept default values for all prompts when CLI flags are omitted. (default: disabled)
4853
-h, --help display help for command
54+
```
4955

56+
### compile-genesis
57+
58+
```text
59+
Usage: network-bootstrapper compile-genesis [options]
60+
61+
Merge per-account allocation ConfigMaps into a Besu genesis file.
62+
63+
Options:
64+
--genesis-configmap-name <name> Name of the ConfigMap containing the base
65+
genesis JSON. (default: "besu-genesis")
66+
--output-path <path> Filesystem path for the compiled genesis
67+
output. (default: "/data/atk-genesis.json")
68+
-h, --help display help for command
5069
```

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"helm": "helm upgrade --install network ./charts/network -n network --create-namespace --timeout 15m",
2828
"package:pack": "helm package charts/network --destination .",
2929
"package:push:harbor": "helm push ./network-*.tgz oci://ghcr.io/settlemint/network-bootstrapper",
30-
"docs:cli": "cat README.tpl > README.md && printf '\\n```\\n' >> README.md && bun src/index.ts --help >> README.md && printf '\\n\\n' >> README.md && bun src/index.ts generate --help >> README.md && printf '\\n```\\n' >> README.md"
30+
"docs:cli": "./scripts/docs-cli.sh"
3131
},
3232
"devDependencies": {
3333
"@biomejs/biome": "2.2.4",

scripts/docs-cli.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
5+
REPO_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
6+
README_TEMPLATE="${REPO_ROOT}/README.tpl"
7+
README_OUTPUT="${REPO_ROOT}/README.md"
8+
ENTRYPOINT="${REPO_ROOT}/src/index.ts"
9+
10+
if [[ ! -f "${README_TEMPLATE}" ]]; then
11+
echo "README template not found at ${README_TEMPLATE}" >&2
12+
exit 1
13+
fi
14+
15+
cp "${README_TEMPLATE}" "${README_OUTPUT}"
16+
17+
append_section() {
18+
local heading="$1"
19+
shift
20+
local command=("${@}")
21+
22+
{
23+
printf '\n### %s\n\n' "${heading}"
24+
printf '```text\n'
25+
NO_COLOR=1 "${command[@]}"
26+
printf '```\n'
27+
} >> "${README_OUTPUT}"
28+
}
29+
30+
# The template already ends with the CLI usage heading; start sections immediately.
31+
append_section "Global Help" bun "${ENTRYPOINT}" --help
32+
33+
append_section "generate" bun "${ENTRYPOINT}" generate --help
34+
35+
append_section "compile-genesis" bun "${ENTRYPOINT}" compile-genesis --help

0 commit comments

Comments
 (0)