doc: book cli updater (#3576)

This commit is contained in:
Léo Vincent
2023-07-05 17:03:30 +02:00
committed by GitHub
parent 64ca521458
commit 9309279a2a
14 changed files with 1721 additions and 510 deletions

View File

@ -105,11 +105,30 @@ jobs:
retention-days: 1
if-no-files-found: error
up-to-date:
runs-on: ubuntu-latest
name: up-to-date
steps:
- uses: actions/checkout@v3
- name: Try to update the book cli documentation
run: make update-book-cli BUILD_PATH=reth/target
- name: Check if the book cli documentation is up to date
run: |
if [[ -n $(git status --porcelain) ]]; then
echo "Error: Documentation is not up to date. Please run \`make update-book-cli\`."
exit 1
else
echo "The documentation is up to date."
fi
deploy:
# Only deploy if a push to main
if: github.ref_name == 'main' && github.event_name == 'push'
runs-on: ubuntu-latest
needs: [test, lint, build]
needs: [test, lint, build, up-to-date]
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:

View File

@ -196,3 +196,9 @@ db-tools: ## Compile MDBX debugging tools.
@$(MAKE) -C $(MDBX_PATH) IOARENA=1 clean > /dev/null
@echo "Run \"$(DB_TOOLS_DIR)/mdbx_stat\" for the info about MDBX db file."
@echo "Run \"$(DB_TOOLS_DIR)/mdbx_chk\" for the MDBX db file integrity check."
.PHONY: update-book-cli
update-book-cli: ## Update book cli documentation.
cargo build --bin reth --features "$(FEATURES)" --profile "$(PROFILE)"
@echo "Updating book cli doc..."
@./book/cli/update.sh $(BUILD_PATH)

View File

@ -39,7 +39,7 @@ Commands:
db
Database debugging utilities
stage
Manipulate individual stages.
Manipulate individual stages
p2p
P2P Debugging utilities
test-vectors
@ -65,7 +65,7 @@ Logging:
--log.directory <PATH>
The path to put log files in
[default: /Users/georgios/Library/Caches/reth/logs]
[default: /reth/logs]
--log.journald
Log events to journald
@ -73,7 +73,7 @@ Logging:
--log.filter <FILTER>
The filter to use for logs written to the log file
[default: debug]
[default: error]
Display:
-v, --verbosity...

33
book/cli/config.json Normal file
View File

@ -0,0 +1,33 @@
{
"commands": {
"config": [],
"db": {
"stats": [],
"list": [],
"get": [],
"drop": [],
"version": [],
"path": []
},
"debug": {
"execution": [],
"merkle": []
},
"import": [],
"init": [],
"node": [],
"p2p": {
"header": [],
"body": []
},
"stage": {
"run": [],
"drop": [],
"dump": ["execution", "storage-hashing", "account-hashing", "merkle"],
"unwind": ["to-block", "num-blocks"]
},
"test-vectors": {
"tables": []
}
}
}

View File

@ -14,6 +14,9 @@ Options:
--default
Show the default config
-h, --help
Print help (see a summary with '-h')
Logging:
--log.persistent
The flag to enable persistent logs
@ -21,7 +24,7 @@ Logging:
--log.directory <PATH>
The path to put log files in
[default: /Users/georgios/Library/Caches/reth/logs]
[default: /reth/logs]
--log.journald
Log events to journald
@ -29,7 +32,7 @@ Logging:
--log.filter <FILTER>
The filter to use for logs written to the log file
[default: debug]
[default: error]
Display:
-v, --verbosity...

View File

@ -50,6 +50,23 @@ Options:
-h, --help
Print help (see a summary with '-h')
Logging:
--log.persistent
The flag to enable persistent logs
--log.directory <PATH>
The path to put log files in
[default: /reth/logs]
--log.journald
Log events to journald
--log.filter <FILTER>
The filter to use for logs written to the log file
[default: error]
Display:
-v, --verbosity...
Set the minimum log level.
@ -59,26 +76,160 @@ Display:
-vvv Info
-vvvv Debug
-vvvvv Traces (warning: very verbose!)
-q, --quiet
Silence all log output
```
## `reth db stats`
## `reth db drop`
Deletes all database entries
```bash
$ reth db stats --help
Lists all the tables, their entry count and their size
$ reth db drop --help
Usage: reth db stats [OPTIONS]
Usage: reth db drop [OPTIONS]
Options:
--datadir <DATA_DIR>
The path to the data dir for all reth files and subdirectories.
Defaults to the OS-specific data directory:
- Linux: `$XDG_DATA_HOME/reth/` or `$HOME/.local/share/reth/`
- Windows: `{FOLDERID_RoamingAppData}/reth/`
- macOS: `$HOME/Library/Application Support/reth/`
[default: default]
--chain <CHAIN_OR_PATH>
The chain this node is running.
Possible values are either a built-in chain or the path to a chain specification file.
Built-in chains:
- mainnet
- goerli
- sepolia
[default: mainnet]
-h, --help
Print help (see a summary with '-h')
Logging:
--log.persistent
The flag to enable persistent logs
--log.directory <PATH>
The path to put log files in
[default: /reth/logs]
--log.journald
Log events to journald
--log.filter <FILTER>
The filter to use for logs written to the log file
[default: error]
Display:
-v, --verbosity...
Set the minimum log level.
-v Errors
-vv Warnings
-vvv Info
-vvvv Debug
-vvvvv Traces (warning: very verbose!)
-q, --quiet
Silence all log output
```
## `reth db get`
Gets the content of a table for the given key
```bash
$ reth db get --help
Usage: reth db get [OPTIONS] <TABLE> <KEY>
Arguments:
<TABLE>
The table name
NOTE: The dupsort tables are not supported now.
<KEY>
The key to get content for
Options:
--datadir <DATA_DIR>
The path to the data dir for all reth files and subdirectories.
Defaults to the OS-specific data directory:
- Linux: `$XDG_DATA_HOME/reth/` or `$HOME/.local/share/reth/`
- Windows: `{FOLDERID_RoamingAppData}/reth/`
- macOS: `$HOME/Library/Application Support/reth/`
[default: default]
--chain <CHAIN_OR_PATH>
The chain this node is running.
Possible values are either a built-in chain or the path to a chain specification file.
Built-in chains:
- mainnet
- goerli
- sepolia
[default: mainnet]
-h, --help
Print help (see a summary with '-h')
Logging:
--log.persistent
The flag to enable persistent logs
--log.directory <PATH>
The path to put log files in
[default: /reth/logs]
--log.journald
Log events to journald
--log.filter <FILTER>
The filter to use for logs written to the log file
[default: error]
Display:
-v, --verbosity...
Set the minimum log level.
-v Errors
-vv Warnings
-vvv Info
-vvvv Debug
-vvvvv Traces (warning: very verbose!)
-q, --quiet
Silence all log output
```
## `reth db list`
Lists the contents of a table
```bash
$ reth db list --help
Lists the contents of a table
Usage: reth db list [OPTIONS] <TABLE>
@ -87,15 +238,36 @@ Arguments:
The table name
Options:
--datadir <DATA_DIR>
The path to the data dir for all reth files and subdirectories.
Defaults to the OS-specific data directory:
- Linux: `$XDG_DATA_HOME/reth/` or `$HOME/.local/share/reth/`
- Windows: `{FOLDERID_RoamingAppData}/reth/`
- macOS: `$HOME/Library/Application Support/reth/`
[default: default]
-s, --skip <SKIP>
Skip first N entries
[default: 0]
-r, --reverse <REVERSE>
Reverse the order of the entries. If enabled last table entries are read.
--chain <CHAIN_OR_PATH>
The chain this node is running.
[default: false]
Possible values are either a built-in chain or the path to a chain specification file.
Built-in chains:
- mainnet
- goerli
- sepolia
[default: mainnet]
-r, --reverse
Reverse the order of the entries. If enabled last table entries are read
-l, --len <LEN>
How many items to take from the walker
@ -103,37 +275,182 @@ Options:
[default: 5]
-j, --json
Dump as JSON instead of using TUI.
Dump as JSON instead of using TUI
-h, --help
Print help (see a summary with '-h')
Logging:
--log.persistent
The flag to enable persistent logs
--log.directory <PATH>
The path to put log files in
[default: /reth/logs]
--log.journald
Log events to journald
--log.filter <FILTER>
The filter to use for logs written to the log file
[default: error]
Display:
-v, --verbosity...
Set the minimum log level.
-v Errors
-vv Warnings
-vvv Info
-vvvv Debug
-vvvvv Traces (warning: very verbose!)
-q, --quiet
Silence all log output
```
## `reth db get`
## `reth db path`
Returns the full database path
```bash
$ reth db get --help
Gets the content of a table for the given key
$ reth db path --help
Usage: reth db get [OPTIONS] <TABLE>
Arguments:
<TABLE>
The table name
Usage: reth db path [OPTIONS]
Options:
--key
The key to get content for
--datadir <DATA_DIR>
The path to the data dir for all reth files and subdirectories.
Defaults to the OS-specific data directory:
- Linux: `$XDG_DATA_HOME/reth/` or `$HOME/.local/share/reth/`
- Windows: `{FOLDERID_RoamingAppData}/reth/`
- macOS: `$HOME/Library/Application Support/reth/`
[default: default]
--chain <CHAIN_OR_PATH>
The chain this node is running.
Possible values are either a built-in chain or the path to a chain specification file.
Built-in chains:
- mainnet
- goerli
- sepolia
[default: mainnet]
-h, --help
Print help (see a summary with '-h')
Logging:
--log.persistent
The flag to enable persistent logs
--log.directory <PATH>
The path to put log files in
[default: /reth/logs]
--log.journald
Log events to journald
--log.filter <FILTER>
The filter to use for logs written to the log file
[default: error]
Display:
-v, --verbosity...
Set the minimum log level.
-v Errors
-vv Warnings
-vvv Info
-vvvv Debug
-vvvvv Traces (warning: very verbose!)
-q, --quiet
Silence all log output
```
## `reth db stats`
Lists all the tables, their entry count and their size
```bash
$ reth db stats --help
Usage: reth db stats [OPTIONS]
Options:
--datadir <DATA_DIR>
The path to the data dir for all reth files and subdirectories.
Defaults to the OS-specific data directory:
- Linux: `$XDG_DATA_HOME/reth/` or `$HOME/.local/share/reth/`
- Windows: `{FOLDERID_RoamingAppData}/reth/`
- macOS: `$HOME/Library/Application Support/reth/`
[default: default]
--chain <CHAIN_OR_PATH>
The chain this node is running.
Possible values are either a built-in chain or the path to a chain specification file.
Built-in chains:
- mainnet
- goerli
- sepolia
[default: mainnet]
-h, --help
Print help (see a summary with '-h')
Logging:
--log.persistent
The flag to enable persistent logs
--log.directory <PATH>
The path to put log files in
[default: /reth/logs]
--log.journald
Log events to journald
--log.filter <FILTER>
The filter to use for logs written to the log file
[default: error]
Display:
-v, --verbosity...
Set the minimum log level.
-v Errors
-vv Warnings
-vvv Info
-vvvv Debug
-vvvvv Traces (warning: very verbose!)
-q, --quiet
Silence all log output
```
## `reth db version`
Lists current and local database versions
```bash
$ reth db version --help
Lists current and local database versions
Usage: reth db version [OPTIONS]
@ -163,43 +480,34 @@ Options:
-h, --help
Print help (see a summary with '-h')
```
## `reth db drop`
```bash
$ reth db drop --help
Deletes all database entries
Usage: reth db drop [OPTIONS]
Options:
-h, --help
Print help (see a summary with '-h')
```
## `reth db version`
```bash
$ reth db version --help
Lists current and local database versions
Usage: reth db version [OPTIONS]
Options:
-h, --help
Print help (see a summary with '-h')
```
## `reth db path`
```bash
$ reth db path --help
Returns the full database path
Usage: reth db path [OPTIONS]
Options:
-h, --help
Print help (see a summary with '-h')
Logging:
--log.persistent
The flag to enable persistent logs
--log.directory <PATH>
The path to put log files in
[default: /reth/logs]
--log.journald
Log events to journald
--log.filter <FILTER>
The filter to use for logs written to the log file
[default: error]
Display:
-v, --verbosity...
Set the minimum log level.
-v Errors
-vv Warnings
-vvv Info
-vvvv Debug
-vvvvv Traces (warning: very verbose!)
-q, --quiet
Silence all log output
```

View File

@ -1,19 +1,24 @@
# `reth debug`
Various debug routines
```bash
$ reth debug --help
Various debug routines
Usage: reth debug <COMMAND>
Usage: reth debug [OPTIONS] <COMMAND>
Commands:
execution
Debug the roundtrip execution of blocks as well as the generated data.
Debug the roundtrip execution of blocks as well as the generated data
merkle
Debug the clean & incremental state root calculations.
Debug the clean & incremental state root calculations
help
Print this message or the help of the given subcommand(s)
Options:
-h, --help
Print help (see a summary with '-h')
Logging:
--log.persistent
The flag to enable persistent logs
@ -21,7 +26,7 @@ Logging:
--log.directory <PATH>
The path to put log files in
[default: /Users/georgios/Library/Caches/reth/logs]
[default: /reth/logs]
--log.journald
Log events to journald
@ -29,7 +34,7 @@ Logging:
--log.filter <FILTER>
The filter to use for logs written to the log file
[default: debug]
[default: error]
Display:
-v, --verbosity...
@ -47,11 +52,12 @@ Display:
## `reth debug execution`
Debug the roundtrip execution of blocks as well as the generated data
```bash
$ reth debug execution --help
Debug the roundtrip execution of blocks as well as the generated data.
Usage: reth debug execution [OPTIONS]
Usage: reth debug execution [OPTIONS] --to <TO>
Options:
--datadir <DATA_DIR>
@ -63,6 +69,8 @@ Options:
- Windows: `{FOLDERID_RoamingAppData}/reth/`
- macOS: `$HOME/Library/Application Support/reth/`
[default: default]
--chain <CHAIN_OR_PATH>
The chain this node is running.
@ -75,16 +83,8 @@ Options:
[default: mainnet]
--debug.tip
Set the chain tip manually for testing purposes.
--to
The maximum block height.
--interval
The block interval for sync and unwind.
[default: 1000]
-h, --help
Print help (see a summary with '-h')
Networking:
-d, --disable-discovery
@ -117,6 +117,8 @@ Networking:
--identity <IDENTITY>
Custom node identity
[default: reth/v0.1.0-alpha.1/aarch64-apple-darwin]
--p2p-secret-key <PATH>
Secret key to use for this node.
@ -126,22 +128,66 @@ Networking:
Do not persist peers.
--nat <NAT>
NAT resolution method
NAT resolution method (any|none|upnp|publicip|extip:<IP>)
[default: any]
--port <PORT>
Network listening port. default: 30303
--to <TO>
The maximum block height
--interval <INTERVAL>
The block interval for sync and unwind. Defaults to `1000`
[default: 1000]
Debug:
--debug.tip <TIP>
Set the chain tip manually for testing purposes.
NOTE: This is a temporary flag
Logging:
--log.persistent
The flag to enable persistent logs
--log.directory <PATH>
The path to put log files in
[default: /reth/logs]
--log.journald
Log events to journald
--log.filter <FILTER>
The filter to use for logs written to the log file
[default: error]
Display:
-v, --verbosity...
Set the minimum log level.
-v Errors
-vv Warnings
-vvv Info
-vvvv Debug
-vvvvv Traces (warning: very verbose!)
-q, --quiet
Silence all log output
```
## `reth debug merkle`
Debug the clean & incremental state root calculations
```bash
$ reth debug merkle --help
Debug the clean & incremental state root calculations.
Usage: reth debug merkle [OPTIONS]
Usage: reth debug merkle [OPTIONS] --to <TO>
Options:
--datadir <DATA_DIR>
@ -153,6 +199,8 @@ Options:
- Windows: `{FOLDERID_RoamingAppData}/reth/`
- macOS: `$HOME/Library/Application Support/reth/`
[default: default]
--chain <CHAIN_OR_PATH>
The chain this node is running.
@ -165,9 +213,42 @@ Options:
[default: mainnet]
--to
--to <TO>
The height to finish at
--skip-node-depth
--skip-node-depth <SKIP_NODE_DEPTH>
The depth after which we should start comparing branch nodes
-h, --help
Print help (see a summary with '-h')
Logging:
--log.persistent
The flag to enable persistent logs
--log.directory <PATH>
The path to put log files in
[default: /reth/logs]
--log.journald
Log events to journald
--log.filter <FILTER>
The filter to use for logs written to the log file
[default: error]
Display:
-v, --verbosity...
Set the minimum log level.
-v Errors
-vv Warnings
-vvv Info
-vvvv Debug
-vvvvv Traces (warning: very verbose!)
-q, --quiet
Silence all log output
```

View File

@ -1,9 +1,18 @@
# `reth import`
This syncs RLP encoded blocks from a file
```bash
$ reth import --help
Usage: reth import [OPTIONS]
Usage: reth import [OPTIONS] <IMPORT_PATH>
Arguments:
<IMPORT_PATH>
The path to a block file for import.
The online stages (headers and bodies) are replaced by a file import, after which the
remaining stages are executed.
Options:
--config <FILE>
@ -18,6 +27,8 @@ Options:
- Windows: `{FOLDERID_RoamingAppData}/reth/`
- macOS: `$HOME/Library/Application Support/reth/`
[default: default]
--chain <CHAIN_OR_PATH>
The chain this node is running.
@ -30,11 +41,8 @@ Options:
[default: mainnet]
--path <IMPORT_PATH>
The path to a block file for import.
The online stages (headers and bodies) are replaced by a file import, after which the
remaining stages are executed.
-h, --help
Print help (see a summary with '-h')
Logging:
--log.persistent
@ -43,7 +51,7 @@ Logging:
--log.directory <PATH>
The path to put log files in
[default: /Users/georgios/Library/Caches/reth/logs]
[default: /reth/logs]
--log.journald
Log events to journald
@ -51,7 +59,7 @@ Logging:
--log.filter <FILTER>
The filter to use for logs written to the log file
[default: debug]
[default: error]
Display:
-v, --verbosity...

View File

@ -1,5 +1,7 @@
# `reth init`
Initialize the database from a genesis file
```bash
$ reth init --help
@ -15,6 +17,8 @@ Options:
- Windows: `{FOLDERID_RoamingAppData}/reth/`
- macOS: `$HOME/Library/Application Support/reth/`
[default: default]
--chain <CHAIN_OR_PATH>
The chain this node is running.
@ -27,6 +31,9 @@ Options:
[default: mainnet]
-h, --help
Print help (see a summary with '-h')
Logging:
--log.persistent
The flag to enable persistent logs
@ -34,7 +41,7 @@ Logging:
--log.directory <PATH>
The path to put log files in
[default: /Users/georgios/Library/Caches/reth/logs]
[default: /reth/logs]
--log.journald
Log events to journald
@ -42,7 +49,7 @@ Logging:
--log.filter <FILTER>
The filter to use for logs written to the log file
[default: debug]
[default: error]
Display:
-v, --verbosity...

View File

@ -1,12 +1,10 @@
# `reth node`
The main node operator command.
Start the node
```bash
$ reth node --help
Start the node
Usage: reth node [OPTIONS]
Options:
@ -36,9 +34,6 @@ Options:
[default: mainnet]
--auto-mine
Automatically mine blocks for new transactions
-h, --help
Print help (see a summary with '-h')
@ -79,6 +74,8 @@ Networking:
--identity <IDENTITY>
Custom node identity
[default: reth/v0.1.0-alpha.1/aarch64-apple-darwin]
--p2p-secret-key <PATH>
Secret key to use for this node.
@ -88,14 +85,14 @@ Networking:
Do not persist peers.
--nat <NAT>
NAT resolution method
NAT resolution method (any|none|upnp|publicip|extip:<IP>)
[default: any]
--port <PORT>
Network listening port. default: 30303
Rpc:
RPC:
--http
Enable the HTTP-RPC server
@ -106,7 +103,9 @@ Rpc:
Http server port to listen on
--http.api <HTTP_API>
Rpc Modules to be configured for http server
Rpc Modules to be configured for the HTTP server
[possible values: admin, debug, eth, net, trace, txpool, web3, rpc]
--http.corsdomain <HTTP_CORSDOMAIN>
Http Corsdomain to allow request from
@ -124,7 +123,9 @@ Rpc:
Origins from which to accept WebSocket requests
--ws.api <WS_API>
Rpc Modules to be configured for Ws server
Rpc Modules to be configured for the WS server
[possible values: admin, debug, eth, net, trace, txpool, web3, rpc]
--ipcdisable
Disable the IPC-RPC server
@ -141,48 +142,97 @@ Rpc:
--authrpc.jwtsecret <PATH>
Path to a JWT secret to use for authenticated RPC endpoints
--rpc-max-request-size
Set the maximum RPC request payload size for both HTTP and WS in megabytes.
--rpc-max-request-size <RPC_MAX_REQUEST_SIZE>
Set the maximum RPC request payload size for both HTTP and WS in megabytes
--rpc-max-response-size
Set the maximum RPC response payload size for both HTTP and WS in megabytes.
[default: 15]
--rpc-max-subscriptions-per-connection
Set the the maximum concurrent subscriptions per connection.
--rpc-max-response-size <RPC_MAX_RESPONSE_SIZE>
Set the maximum RPC response payload size for both HTTP and WS in megabytes
--rpc-max-connections
Maximum number of RPC server connections.
[default: 100]
--rpc-max-tracing-requests
Maximum number of concurrent tracing requests.
--rpc-max-subscriptions-per-connection <RPC_MAX_SUBSCRIPTIONS_PER_CONNECTION>
Set the the maximum concurrent subscriptions per connection
--gas-price-oracle
Gas price oracle configuration.
[default: 1024]
--block-cache-len
Maximum number of block cache entries.
--rpc-max-connections <COUNT>
Maximum number of RPC server connections
--receipt-cache-len
Maximum number of receipt cache entries.
[default: 100]
--env-cache-len
Maximum number of env cache entries.
--rpc-max-tracing-requests <COUNT>
Maximum number of concurrent tracing requests
[default: 25]
--rpc.gascap <GAS_CAP>
Maximum gas limit for `eth_call` and call tracing RPC methods
[default: 30000000]
GAS PRICE ORACLE:
--gpo.blocks <BLOCKS>
Number of recent blocks to check for gas price
[default: 20]
--gpo.ignoreprice <IGNORE_PRICE>
Gas Price below which gpo will ignore transactions
[default: 2]
--gpo.maxprice <MAX_PRICE>
Maximum transaction priority fee(or gasprice before London Fork) to be recommended by gpo
[default: 500000000000]
--gpo.percentile <PERCENTILE>
The percentile of gas prices to use for the estimate
[default: 60]
--block-cache-size <BLOCK_CACHE_SIZE>
Max size for cached block data in megabytes
[default: 500]
--receipt-cache-size <RECEIPT_CACHE_SIZE>
Max size for cached receipt data in megabytes
[default: 500]
--env-cache-size <ENV_CACHE_SIZE>
Max size for cached evm env data in megabytes
[default: 1]
Builder:
--builder.extradata
Block extra data set by the payload builder.
--builder.extradata <EXTRADATA>
Block extra data set by the payload builder
--builder.gaslimit
Target gas ceiling for built blocks.
[default: reth/v0.1.0-alpha.1/macos]
--builder.interval
The interval at which the job should build a new payload after the last (in seconds).
--builder.gaslimit <GAS_LIMIT>
Target gas ceiling for built blocks
--builder.deadline
The deadline for when the payload builder job should resolve.
[default: 30000000]
--builder.max-tasks
Maximum number of tasks to spawn for building a payload.
--builder.interval <SECONDS>
The interval at which the job should build a new payload after the last (in seconds)
[default: 1]
--builder.deadline <SECONDS>
The deadline for when the payload builder job should resolve
[default: 12]
--builder.max-tasks <MAX_PAYLOAD_TASKS>
Maximum number of tasks to spawn for building a payload
[default: 3]
Debug:
--debug.continuous
@ -213,6 +263,10 @@ Debug:
--debug.hook-all
Hook on every transaction in a block
Rpc:
--auto-mine
Automatically mine blocks for new transactions
Logging:
--log.persistent
The flag to enable persistent logs
@ -220,7 +274,7 @@ Logging:
--log.directory <PATH>
The path to put log files in
[default: /Users/georgios/Library/Caches/reth/logs]
[default: /reth/logs]
--log.journald
Log events to journald
@ -228,7 +282,7 @@ Logging:
--log.filter <FILTER>
The filter to use for logs written to the log file
[default: debug]
[default: error]
Display:
-v, --verbosity...

View File

@ -1,8 +1,9 @@
# `reth p2p`
P2P Debugging utilities
```bash
$ reth p2p --help
P2P Debugging utilities
Usage: reth p2p [OPTIONS] <COMMAND>
@ -82,7 +83,7 @@ Logging:
--log.directory <PATH>
The path to put log files in
[default: /Users/georgios/Library/Caches/reth/logs]
[default: /reth/logs]
--log.journald
Log events to journald
@ -90,7 +91,55 @@ Logging:
--log.filter <FILTER>
The filter to use for logs written to the log file
[default: debug]
[default: error]
Display:
-v, --verbosity...
Set the minimum log level.
-v Errors
-vv Warnings
-vvv Info
-vvvv Debug
-vvvvv Traces (warning: very verbose!)
-q, --quiet
Silence all log output
```
## `reth p2p body`
Download block body
```bash
$ reth p2p body --help
Usage: reth p2p body [OPTIONS] <ID>
Arguments:
<ID>
The block number or hash
Options:
-h, --help
Print help (see a summary with '-h')
Logging:
--log.persistent
The flag to enable persistent logs
--log.directory <PATH>
The path to put log files in
[default: /reth/logs]
--log.journald
Log events to journald
--log.filter <FILTER>
The filter to use for logs written to the log file
[default: error]
Display:
-v, --verbosity...
@ -108,28 +157,48 @@ Display:
## `reth p2p header`
```bash
$ reth p2p header --help
Download block header
Usage: reth p2p header <ID>
```bash
$ reth p2p header --help
Usage: reth p2p header [OPTIONS] <ID>
Arguments:
<ID>
The header number or hash
```
## `reth p2p body`
```bash
$ reth p2p body --help
Download block body
Usage: reth p2p body <ID>
Arguments:
<ID>
The block number or hash
Options:
-h, --help
Print help (see a summary with '-h')
Logging:
--log.persistent
The flag to enable persistent logs
--log.directory <PATH>
The path to put log files in
[default: /reth/logs]
--log.journald
Log events to journald
--log.filter <FILTER>
The filter to use for logs written to the log file
[default: error]
Display:
-v, --verbosity...
Set the minimum log level.
-v Errors
-vv Warnings
-vvv Info
-vvvv Debug
-vvvvv Traces (warning: very verbose!)
-q, --quiet
Silence all log output
```

View File

@ -1,27 +1,28 @@
# `reth stage`
Manipulate individual stages
```bash
$ reth stage --help
Usage: reth db <COMMAND>
Usage: reth stage [OPTIONS] <COMMAND>
Commands:
run
Run a single stage.
Note that this won't use the Pipeline and as a result runs stages
assuming that all the data can be held in memory. It is not recommended
to run a stage for really large block ranges if your computer does not have
a lot of memory to store all the data.
Run a single stage
drop
Drop a stage's tables from the database.
Drop a stage's tables from the database
dump
Dumps a stage from a range into a new database.
Dumps a stage from a range into a new database
unwind
Unwinds a certain block range, deleting it from the database.
Unwinds a certain block range, deleting it from the database
help
Print this message or the help of the given subcommand(s)
Options:
-h, --help
Print help (see a summary with '-h')
Logging:
--log.persistent
The flag to enable persistent logs
@ -29,7 +30,7 @@ Logging:
--log.directory <PATH>
The path to put log files in
[default: /Users/georgios/Library/Caches/reth/logs]
[default: /reth/logs]
--log.journald
Log events to journald
@ -37,7 +38,381 @@ Logging:
--log.filter <FILTER>
The filter to use for logs written to the log file
[default: debug]
[default: error]
Display:
-v, --verbosity...
Set the minimum log level.
-v Errors
-vv Warnings
-vvv Info
-vvvv Debug
-vvvvv Traces (warning: very verbose!)
-q, --quiet
Silence all log output
```
## `reth stage drop`
Drop a stage's tables from the database
```bash
$ reth stage drop --help
Usage: reth stage drop [OPTIONS] <STAGE>
Arguments:
<STAGE>
[possible values: headers, bodies, senders, execution, account-hashing, storage-hashing, hashing, merkle, tx-lookup, history, account-history, storage-history, total-difficulty]
Options:
--datadir <DATA_DIR>
The path to the data dir for all reth files and subdirectories.
Defaults to the OS-specific data directory:
- Linux: `$XDG_DATA_HOME/reth/` or `$HOME/.local/share/reth/`
- Windows: `{FOLDERID_RoamingAppData}/reth/`
- macOS: `$HOME/Library/Application Support/reth/`
[default: default]
--chain <CHAIN_OR_PATH>
The chain this node is running.
Possible values are either a built-in chain or the path to a chain specification file.
Built-in chains:
- mainnet
- goerli
- sepolia
[default: mainnet]
-h, --help
Print help (see a summary with '-h')
Logging:
--log.persistent
The flag to enable persistent logs
--log.directory <PATH>
The path to put log files in
[default: /reth/logs]
--log.journald
Log events to journald
--log.filter <FILTER>
The filter to use for logs written to the log file
[default: error]
Display:
-v, --verbosity...
Set the minimum log level.
-v Errors
-vv Warnings
-vvv Info
-vvvv Debug
-vvvvv Traces (warning: very verbose!)
-q, --quiet
Silence all log output
```
## `reth stage dump`
Dumps a stage from a range into a new database
```bash
$ reth stage dump --help
Usage: reth stage dump [OPTIONS] <COMMAND>
Commands:
execution
Execution stage
storage-hashing
StorageHashing stage
account-hashing
AccountHashing stage
merkle
Merkle stage
help
Print this message or the help of the given subcommand(s)
Options:
--datadir <DATA_DIR>
The path to the data dir for all reth files and subdirectories.
Defaults to the OS-specific data directory:
- Linux: `$XDG_DATA_HOME/reth/` or `$HOME/.local/share/reth/`
- Windows: `{FOLDERID_RoamingAppData}/reth/`
- macOS: `$HOME/Library/Application Support/reth/`
[default: default]
--chain <CHAIN_OR_PATH>
The chain this node is running.
Possible values are either a built-in chain or the path to a chain specification file.
Built-in chains:
- mainnet
- goerli
- sepolia
[default: mainnet]
-h, --help
Print help (see a summary with '-h')
Logging:
--log.persistent
The flag to enable persistent logs
--log.directory <PATH>
The path to put log files in
[default: /reth/logs]
--log.journald
Log events to journald
--log.filter <FILTER>
The filter to use for logs written to the log file
[default: error]
Display:
-v, --verbosity...
Set the minimum log level.
-v Errors
-vv Warnings
-vvv Info
-vvvv Debug
-vvvvv Traces (warning: very verbose!)
-q, --quiet
Silence all log output
```
### `reth stage dump execution`
Execution stage
```bash
$ reth stage dump execution --help
Usage: reth stage dump execution [OPTIONS] --output-db <OUTPUT_PATH> --from <FROM> --to <TO>
Options:
--output-db <OUTPUT_PATH>
The path to the new database folder.
-f, --from <FROM>
From which block
-t, --to <TO>
To which block
-d, --dry-run
If passed, it will dry-run a stage execution from the newly created database right after dumping
-h, --help
Print help (see a summary with '-h')
Logging:
--log.persistent
The flag to enable persistent logs
--log.directory <PATH>
The path to put log files in
[default: /reth/logs]
--log.journald
Log events to journald
--log.filter <FILTER>
The filter to use for logs written to the log file
[default: error]
Display:
-v, --verbosity...
Set the minimum log level.
-v Errors
-vv Warnings
-vvv Info
-vvvv Debug
-vvvvv Traces (warning: very verbose!)
-q, --quiet
Silence all log output
```
### `reth stage dump storage-hashing`
StorageHashing stage
```bash
$ reth stage dump storage-hashing --help
Usage: reth stage dump storage-hashing [OPTIONS] --output-db <OUTPUT_PATH> --from <FROM> --to <TO>
Options:
--output-db <OUTPUT_PATH>
The path to the new database folder.
-f, --from <FROM>
From which block
-t, --to <TO>
To which block
-d, --dry-run
If passed, it will dry-run a stage execution from the newly created database right after dumping
-h, --help
Print help (see a summary with '-h')
Logging:
--log.persistent
The flag to enable persistent logs
--log.directory <PATH>
The path to put log files in
[default: /reth/logs]
--log.journald
Log events to journald
--log.filter <FILTER>
The filter to use for logs written to the log file
[default: error]
Display:
-v, --verbosity...
Set the minimum log level.
-v Errors
-vv Warnings
-vvv Info
-vvvv Debug
-vvvvv Traces (warning: very verbose!)
-q, --quiet
Silence all log output
```
### `reth stage dump account-hashing`
AccountHashing stage
```bash
$ reth stage dump account-hashing --help
Usage: reth stage dump account-hashing [OPTIONS] --output-db <OUTPUT_PATH> --from <FROM> --to <TO>
Options:
--output-db <OUTPUT_PATH>
The path to the new database folder.
-f, --from <FROM>
From which block
-t, --to <TO>
To which block
-d, --dry-run
If passed, it will dry-run a stage execution from the newly created database right after dumping
-h, --help
Print help (see a summary with '-h')
Logging:
--log.persistent
The flag to enable persistent logs
--log.directory <PATH>
The path to put log files in
[default: /reth/logs]
--log.journald
Log events to journald
--log.filter <FILTER>
The filter to use for logs written to the log file
[default: error]
Display:
-v, --verbosity...
Set the minimum log level.
-v Errors
-vv Warnings
-vvv Info
-vvvv Debug
-vvvvv Traces (warning: very verbose!)
-q, --quiet
Silence all log output
```
### `reth stage dump merkle`
Merkle stage
```bash
$ reth stage dump merkle --help
Usage: reth stage dump merkle [OPTIONS] --output-db <OUTPUT_PATH> --from <FROM> --to <TO>
Options:
--output-db <OUTPUT_PATH>
The path to the new database folder.
-f, --from <FROM>
From which block
-t, --to <TO>
To which block
-d, --dry-run
If passed, it will dry-run a stage execution from the newly created database right after dumping
-h, --help
Print help (see a summary with '-h')
Logging:
--log.persistent
The flag to enable persistent logs
--log.directory <PATH>
The path to put log files in
[default: /reth/logs]
--log.journald
Log events to journald
--log.filter <FILTER>
The filter to use for logs written to the log file
[default: error]
Display:
-v, --verbosity...
@ -55,14 +430,20 @@ Display:
## `reth stage run`
```bash
Usage: reth stage run [OPTIONS] --from <FROM> --to <TO> --stage <STAGE>
Run a single stage.
Note that this won't use the Pipeline and as a result runs stages
assuming that all the data can be held in memory. It is not recommended
to run a stage for really large block ranges if your computer does not have
a lot of memory to store all the data.
```bash
$ reth stage run --help
Note that this won't use the Pipeline and as a result runs stages assuming that all the data can be held in memory. It is not recommended to run a stage for really large block ranges if your computer does not have a lot of memory to store all the data.
Usage: reth stage run [OPTIONS] --from <FROM> --to <TO> <STAGE>
Arguments:
<STAGE>
The name of the stage to run
[possible values: headers, bodies, senders, execution, account-hashing, storage-hashing, hashing, merkle, tx-lookup, history, account-history, storage-history, total-difficulty]
Options:
--config <FILE>
@ -96,18 +477,13 @@ Options:
The metrics will be served at the given interface and port.
--stage <STAGE>
The name of the stage to run
[possible values: headers, bodies, senders, execution, account-hashing, storage-hashing, hashing, merkle, tx-lookup, history, account-history, storage-history, total-difficulty]
--from <FROM>
The height to start at
-t, --to <TO>
The end of the stage
--batch-size
--batch-size <BATCH_SIZE>
Batch size for stage execution and unwind
-s, --skip-unwind
@ -115,11 +491,6 @@ Options:
You can optionally skip the unwinding phase if you're syncing a block range that has not been synced before.
--commit
Commits the changes in the database. WARNING: potentially destructive.
Useful when you want to run diagnostics on the database.
-h, --help
Print help (see a summary with '-h')
@ -151,209 +522,77 @@ Networking:
The path to the known peers file. Connected peers are dumped to this file on nodes
shutdown, and read on startup. Cannot be used with `--no-persist-peers`.
--identity
--identity <IDENTITY>
Custom node identity
--p2p-secret-key
[default: reth/v0.1.0-alpha.1/aarch64-apple-darwin]
--p2p-secret-key <PATH>
Secret key to use for this node.
This will also deterministically set the peer ID. If not specified, it will be set in the
data dir for the chain being used.
This will also deterministically set the peer ID. If not specified, it will be set in the data dir for the chain being used.
--no-persist-peers
Do not persist peers.
--nat <NAT>
NAT resolution method
NAT resolution method (any|none|upnp|publicip|extip:<IP>)
[default: any]
--port <PORT>
Network listening port. default: 30303
```
## `reth stage drop`
-c, --commit
Commits the changes in the database. WARNING: potentially destructive.
```bash
Usage: reth stage drop [OPTIONS] <STAGE>
Drop a stage's tables from the database.
Useful when you want to run diagnostics on the database.
Arguments:
<STAGE>
The name of the stage to drop
Logging:
--log.persistent
The flag to enable persistent logs
[possible values: headers, bodies, senders, execution, account-hashing, storage-hashing, hashing, merkle, tx-lookup, history, account-history, storage-history, total-difficulty]
--log.directory <PATH>
The path to put log files in
Options:
--datadir <DATA_DIR>
The path to the data dir for all reth files and subdirectories.
[default: /reth/logs]
Defaults to the OS-specific data directory:
--log.journald
Log events to journald
- Linux: `$XDG_DATA_HOME/reth/` or `$HOME/.local/share/reth/`
- Windows: `{FOLDERID_RoamingAppData}/reth/`
- macOS: `$HOME/Library/Application Support/reth/`
--log.filter <FILTER>
The filter to use for logs written to the log file
[default: default]
[default: error]
--chain <CHAIN_OR_PATH>
The chain this node is running.
Display:
-v, --verbosity...
Set the minimum log level.
Possible values are either a built-in chain or the path to a chain specification file.
-v Errors
-vv Warnings
-vvv Info
-vvvv Debug
-vvvvv Traces (warning: very verbose!)
Built-in chains:
- mainnet
- goerli
- sepolia
[default: mainnet]
```
## `reth stage dump`
```bash
Usage: reth stage dump [OPTIONS] <COMMAND>
Dumps a stage from a range into a new database.
Commands:
execution
Execution stage.
storage-hashing
StorageHashing stage.
account-hashing
AccountHashing stage.
merkle
Merkle stage.
help
Print this message or the help of the given subcommand(s)
Options:
--datadir <DATA_DIR>
The path to the data dir for all reth files and subdirectories.
Defaults to the OS-specific data directory:
- Linux: `$XDG_DATA_HOME/reth/` or `$HOME/.local/share/reth/`
- Windows: `{FOLDERID_RoamingAppData}/reth/`
- macOS: `$HOME/Library/Application Support/reth/`
[default: default]
--chain <CHAIN_OR_PATH>
The chain this node is running.
Possible values are either a built-in chain or the path to a chain specification file.
Built-in chains:
- mainnet
- goerli
- sepolia
[default: mainnet]
```
### `reth stage dump execution`
```bash
Usage: reth stage dump execution [OPTIONS]
Execution stage.
Options:
--output_db <OUTPUT_PATH>
The path to the new database folder.
-f, --from <FROM>
From which block.
-t, --to <TO>
To which block.
-d, --dry-run <DRY_RUN>
If passed, it will dry-run a stage execution from the newly created database right after
dumping.
[default: false]
```
### `reth stage dump storage-hashing`
```bash
Usage: reth stage dump storage-hashing [OPTIONS]
StorageHashing stage.
Options:
--output_db <OUTPUT_PATH>
The path to the new database folder.
-f, --from <FROM>
From which block.
-t, --to <TO>
To which block.
-d, --dry-run <DRY_RUN>
If passed, it will dry-run a stage execution from the newly created database right after
dumping.
[default: false]
```
### `reth stage dump account-hashing`
```bash
Usage: reth stage dump account-hashing [OPTIONS]
AccountHashing stage.
Options:
--output_db <OUTPUT_PATH>
The path to the new database folder.
-f, --from <FROM>
From which block.
-t, --to <TO>
To which block.
-d, --dry-run <DRY_RUN>
If passed, it will dry-run a stage execution from the newly created database right after
dumping.
[default: false]
```
### `reth stage dump merkle`
```bash
Usage: reth stage dump merkle [OPTIONS]
Merkle stage.
Options:
--output_db <OUTPUT_PATH>
The path to the new database folder.
-f, --from <FROM>
From which block.
-t, --to <TO>
To which block.
-d, --dry-run <DRY_RUN>
If passed, it will dry-run a stage execution from the newly created database right after
dumping.
[default: false]
-q, --quiet
Silence all log output
```
## `reth stage unwind`
Unwinds a certain block range, deleting it from the database
```bash
$ reth stage unwind --help
Usage: reth stage unwind [OPTIONS] <COMMAND>
Unwinds a certain block range, deleting it from the database.
Commands:
to-block
Unwinds the database until the given block number (range is inclusive).
Unwinds the database until the given block number (range is inclusive)
num-blocks
Unwinds the given number of blocks from the database.
Unwinds the given number of blocks from the database
help
Print this message or the help of the given subcommand(s)
@ -380,4 +619,179 @@ Options:
- sepolia
[default: mainnet]
-h, --help
Print help (see a summary with '-h')
Logging:
--log.persistent
The flag to enable persistent logs
--log.directory <PATH>
The path to put log files in
[default: /reth/logs]
--log.journald
Log events to journald
--log.filter <FILTER>
The filter to use for logs written to the log file
[default: error]
Display:
-v, --verbosity...
Set the minimum log level.
-v Errors
-vv Warnings
-vvv Info
-vvvv Debug
-vvvvv Traces (warning: very verbose!)
-q, --quiet
Silence all log output
```
### `reth stage unwind to-block`
Unwinds the database until the given block number (range is inclusive)
```bash
$ reth stage unwind to-block --help
Usage: reth stage unwind to-block [OPTIONS] <TARGET>
Arguments:
<TARGET>
Options:
--datadir <DATA_DIR>
The path to the data dir for all reth files and subdirectories.
Defaults to the OS-specific data directory:
- Linux: `$XDG_DATA_HOME/reth/` or `$HOME/.local/share/reth/`
- Windows: `{FOLDERID_RoamingAppData}/reth/`
- macOS: `$HOME/Library/Application Support/reth/`
[default: default]
--chain <CHAIN_OR_PATH>
The chain this node is running.
Possible values are either a built-in chain or the path to a chain specification file.
Built-in chains:
- mainnet
- goerli
- sepolia
[default: mainnet]
-h, --help
Print help (see a summary with '-h')
Logging:
--log.persistent
The flag to enable persistent logs
--log.directory <PATH>
The path to put log files in
[default: /reth/logs]
--log.journald
Log events to journald
--log.filter <FILTER>
The filter to use for logs written to the log file
[default: error]
Display:
-v, --verbosity...
Set the minimum log level.
-v Errors
-vv Warnings
-vvv Info
-vvvv Debug
-vvvvv Traces (warning: very verbose!)
-q, --quiet
Silence all log output
```
### `reth stage unwind num-blocks`
Unwinds the given number of blocks from the database
```bash
$ reth stage unwind num-blocks --help
Usage: reth stage unwind num-blocks [OPTIONS] <AMOUNT>
Arguments:
<AMOUNT>
Options:
--datadir <DATA_DIR>
The path to the data dir for all reth files and subdirectories.
Defaults to the OS-specific data directory:
- Linux: `$XDG_DATA_HOME/reth/` or `$HOME/.local/share/reth/`
- Windows: `{FOLDERID_RoamingAppData}/reth/`
- macOS: `$HOME/Library/Application Support/reth/`
[default: default]
--chain <CHAIN_OR_PATH>
The chain this node is running.
Possible values are either a built-in chain or the path to a chain specification file.
Built-in chains:
- mainnet
- goerli
- sepolia
[default: mainnet]
-h, --help
Print help (see a summary with '-h')
Logging:
--log.persistent
The flag to enable persistent logs
--log.directory <PATH>
The path to put log files in
[default: /reth/logs]
--log.journald
Log events to journald
--log.filter <FILTER>
The filter to use for logs written to the log file
[default: error]
Display:
-v, --verbosity...
Set the minimum log level.
-v Errors
-vv Warnings
-vvv Info
-vvvv Debug
-vvvvv Traces (warning: very verbose!)
-q, --quiet
Silence all log output
```

View File

@ -1,16 +1,97 @@
# `reth test-vectors`
Generate Test Vectors
```bash
$ reth test-vectors --help
Generate Test Vectors
Usage: reth test-vectors <COMMAND> <NAMES>
Usage: reth test-vectors [OPTIONS] <COMMAND>
Commands:
tables
Generates test vectors for specified tables. If no table is specified, generate for all.
Generates test vectors for specified tables. If no table is specified, generate for all
help
Print this message or the help of the given subcommand(s)
Options:
-h, --help
Print help (see a summary with '-h')
Logging:
--log.persistent
The flag to enable persistent logs
--log.directory <PATH>
The path to put log files in
[default: /reth/logs]
--log.journald
Log events to journald
--log.filter <FILTER>
The filter to use for logs written to the log file
[default: error]
Display:
-v, --verbosity...
Set the minimum log level.
-v Errors
-vv Warnings
-vvv Info
-vvvv Debug
-vvvvv Traces (warning: very verbose!)
-q, --quiet
Silence all log output
```
## `reth test-vectors tables`
Generates test vectors for specified tables. If no table is specified, generate for all
```bash
$ reth test-vectors tables --help
Usage: reth test-vectors tables [OPTIONS] [NAMES]...
Arguments:
<NAMES>
List of table names. Case-sensitive.
[NAMES]...
List of table names. Case-sensitive
Options:
-h, --help
Print help (see a summary with '-h')
Logging:
--log.persistent
The flag to enable persistent logs
--log.directory <PATH>
The path to put log files in
[default: /reth/logs]
--log.journald
Log events to journald
--log.filter <FILTER>
The filter to use for logs written to the log file
[default: error]
Display:
-v, --verbosity...
Set the minimum log level.
-v Errors
-vv Warnings
-vvv Info
-vvvv Debug
-vvvvv Traces (warning: very verbose!)
-q, --quiet
Silence all log output
```

128
book/cli/update.sh Executable file
View File

@ -0,0 +1,128 @@
#!/bin/bash
# Define the build path.
build_path=$1
if [ -z "$build_path" ]; then
echo "Build path variable is not defined. Exiting..."
exit 1
fi
reth_path=./$build_path/debug/reth
echo "Using reth path: $reth_path (build path: $build_path)"
# Define the path to the JSON configuration file.
json_file="./book/cli/config.json"
echo "Using config file: $json_file"
# Read commands from JSON configuration file.
read_cmds_from_json() {
local json_file="$1"
jq -r '.commands | keys[]' "$json_file"
}
# Read subcommands for a given command from JSON configuration file.
read_subcmds_from_json() {
local json_file="$1"
local cmd="$2"
jq -r ".commands[\"$cmd\"] | if type == \"object\" then keys[] else .[] end" "$json_file"
}
# Read subsubcommands for a given command and subcommand from JSON configuration file.
read_subsubcmds_from_json() {
local json_file="$1"
local cmd="$2"
local subcmd="$3"
jq -r ".commands[\"$cmd\"][\"$subcmd\"][]" "$json_file"
}
# Update the main documentation.
update_main_doc() {
local file_path="./book/cli/cli.md"
local cmd_help_output=$($reth_path --help)
sed -i -e '/## Commands/,$d' "$file_path"
cat >> "$file_path" << EOF
## Commands
\`\`\`bash
$ reth --help
$cmd_help_output
\`\`\`
EOF
}
# Update any `reth` command documentation.
update_cli_cmd() {
local cmd="$1"
local subcmds=("${@:2}")
echo "reth $cmd"
local cmd_help_output=$($reth_path "$cmd" --help)
local description=$(echo "$cmd_help_output" | head -n 1)
cat > "./book/cli/$cmd.md" << EOF
# \`reth $cmd\`
$(if [[ -n "$description" ]]; then echo "$description"; fi)
\`\`\`bash
$ reth $cmd --help
$(echo "$cmd_help_output" | sed '1d')
\`\`\`
EOF
for subcmd in "${subcmds[@]}"; do
echo " ├── $subcmd"
local subcmd_help_output=$($reth_path "$cmd" "$subcmd" --help)
local subcmd_description=$(echo "$subcmd_help_output" | head -n 1)
cat >> "book/cli/$cmd.md" << EOF
## \`reth $cmd $subcmd\`
$(if [[ -n "$subcmd_description" ]]; then echo "$subcmd_description"; fi)
\`\`\`bash
$ reth $cmd $subcmd --help
$(echo "$subcmd_help_output" | sed '1d')
\`\`\`
EOF
# Read subsubcommands and update documentation
subsubcmds=($(read_subsubcmds_from_json "$json_file" "$cmd" "$subcmd"))
for subsubcmd in "${subsubcmds[@]}"; do
echo " ├── $subsubcmd"
local subsubcmd_help_output=$($reth_path "$cmd" "$subcmd" "$subsubcmd" --help)
local subsubcmd_description=$(echo "$subsubcmd_help_output" | head -n 1)
cat >> "book/cli/$cmd.md" << EOF
### \`reth $cmd $subcmd $subsubcmd\`
$(if [[ -n "$subsubcmd_description" ]]; then echo "$subsubcmd_description"; fi)
\`\`\`bash
$ reth $cmd $subcmd $subsubcmd --help
$(echo "$subsubcmd_help_output" | sed '1d')
\`\`\`
EOF
done
done
}
# Update the book CLI documentation.
main() {
update_main_doc
# Update commands doc.
cmds=($(read_cmds_from_json "$json_file"))
for cmd in "${cmds[@]}"; do
subcmds=($(read_subcmds_from_json "$json_file" "$cmd"))
update_cli_cmd "$cmd" "${subcmds[@]}"
done
# Update default paths on both Linux and macOS to avoid triggering the CI.
sed -i -e 's/default: \/.*\/reth\//default: \/reth\//g' ./book/cli/*.md
rm ./book/cli/*.md-e
echo "Book updated successfully."
}
main