Generate single markdown document with all CLI commands and usage to paste at the beginning of AI chat sessions. Claude does extremely well with it. AI likes markdown.
OS: Linux
Name the file create_cli_reference.sh
Change permissions:
chmod +x create_cli_reference.sh
Run
./create_cli_reference.sh
It takes about 6 or 7 minutes on my mini PC to generate the openclaw_cli_reference.md document.
create_cli_reference.sh
#!/bin/bash# Generate a clean OpenClaw CLI reference document without the headers
OUTPUT="openclaw_cli_reference.md"
B='`'
BTICK="${B}${B}${B}"
# Terminal Status Message
echo "🦞 OpenClaw CLI Reference Generator"
echo "Generating documentation, please wait..."
echo "# OpenClaw CLI Full Reference" > "$OUTPUT"
echo "Generated on: $(date)" >> "$OUTPUT"
# Core top-level commands to recurse
COMMANDS=("gateway" "models" "channels" "plugins" "secrets" "agents" "doctor" "acp" "approvals" "backup" "browser" "clawbot" "config" "cron" "daemon" "devices" "directory" "dns" "hooks" "memory" "message" "node" "nodes" "pairing" "sandbox" "security" "sessions" "skills" "system" "update" "webhooks")
for cmd in "${COMMANDS[@]}"; do
echo -e "\n## Command: openclaw $cmd" >> "$OUTPUT"
echo "$BTICK" >> "$OUTPUT"
openclaw $cmd --help >> "$OUTPUT" 2>&1
echo "$BTICK" >> "$OUTPUT"
# Recursively grab common subcommands
for sub in "list" "add" "inspect" "status"; do
if openclaw $cmd $sub --help > /dev/null 2>&1; then
echo -e "\n### Subcommand: openclaw $cmd $sub" >> "$OUTPUT"
echo "$BTICK" >> "$OUTPUT"
openclaw $cmd $sub --help >> "$OUTPUT" 2>&1
echo "$BTICK" >> "$OUTPUT"
fi
done
done
# Clean up "🦞 OpenClaw" header lines
sed -i '/^🦞 OpenClaw/d' "$OUTPUT"
# Clean up any quip lines printed before "Usage:" inside code blocks
sed -i '/^🦞 OpenClaw/d; /^[[:space:]]*[A-Z].*—.*$/d; /^[[:space:]]*[A-Z][^:]*;[^:]*$/d' "$OUTPUT"
echo "Done!"
echo "🦞 OpenClaw CLI documentation generated: $OUTPUT"