Skip to content

Commit

Permalink
chore: preprocess --help string
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniPopes committed Dec 13, 2023
1 parent 82f7f45 commit 5f691ea
Show file tree
Hide file tree
Showing 35 changed files with 48 additions and 39 deletions.
11 changes: 10 additions & 1 deletion book/cli/help.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def help_markdown(cmd: list[str], s: str):
```bash
$ {' '.join(cmd)} --help
{s.strip()}
{preprocess_help(s.strip())}
```"""


Expand Down Expand Up @@ -250,6 +250,15 @@ def command_name(cmd: str):
"""Returns the name of a command."""
return cmd.split("/")[-1]

def preprocess_help(s: str):
"""Preprocesses the help output of a command."""
# Remove the user-specific paths.
s = re.sub(r"default: /.*/reth", "default: <CACHE_DIR>", s)
# Remove the commit SHA.
s = re.sub(r"-[0-9A-Fa-f]{7}/", "-XXXXXXX/", s)

return s


if __name__ == "__main__":
main()
2 changes: 1 addition & 1 deletion book/cli/reth.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Logging:
--log.file.directory <PATH>
The path to put log files in
[default: /home/doni/.config/cache/reth/logs]
[default: <CACHE_DIR>/logs]
--log.file.max-size <SIZE>
The maximum size (in MB) of one log file
Expand Down
2 changes: 1 addition & 1 deletion book/cli/reth/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Logging:
--log.file.directory <PATH>
The path to put log files in
[default: /home/doni/.config/cache/reth/logs]
[default: <CACHE_DIR>/logs]
--log.file.max-size <SIZE>
The maximum size (in MB) of one log file
Expand Down
2 changes: 1 addition & 1 deletion book/cli/reth/db.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Logging:
--log.file.directory <PATH>
The path to put log files in
[default: /home/doni/.config/cache/reth/logs]
[default: <CACHE_DIR>/logs]
--log.file.max-size <SIZE>
The maximum size (in MB) of one log file
Expand Down
2 changes: 1 addition & 1 deletion book/cli/reth/db/clear.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Logging:
--log.file.directory <PATH>
The path to put log files in
[default: /home/doni/.config/cache/reth/logs]
[default: <CACHE_DIR>/logs]
--log.file.max-size <SIZE>
The maximum size (in MB) of one log file
Expand Down
2 changes: 1 addition & 1 deletion book/cli/reth/db/diff.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Logging:
--log.file.directory <PATH>
The path to put log files in
[default: /home/doni/.config/cache/reth/logs]
[default: <CACHE_DIR>/logs]
--log.file.max-size <SIZE>
The maximum size (in MB) of one log file
Expand Down
2 changes: 1 addition & 1 deletion book/cli/reth/db/drop.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Logging:
--log.file.directory <PATH>
The path to put log files in
[default: /home/doni/.config/cache/reth/logs]
[default: <CACHE_DIR>/logs]
--log.file.max-size <SIZE>
The maximum size (in MB) of one log file
Expand Down
2 changes: 1 addition & 1 deletion book/cli/reth/db/get.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Logging:
--log.file.directory <PATH>
The path to put log files in
[default: /home/doni/.config/cache/reth/logs]
[default: <CACHE_DIR>/logs]
--log.file.max-size <SIZE>
The maximum size (in MB) of one log file
Expand Down
2 changes: 1 addition & 1 deletion book/cli/reth/db/list.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ Logging:
--log.file.directory <PATH>
The path to put log files in
[default: /home/doni/.config/cache/reth/logs]
[default: <CACHE_DIR>/logs]
--log.file.max-size <SIZE>
The maximum size (in MB) of one log file
Expand Down
2 changes: 1 addition & 1 deletion book/cli/reth/db/path.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Logging:
--log.file.directory <PATH>
The path to put log files in
[default: /home/doni/.config/cache/reth/logs]
[default: <CACHE_DIR>/logs]
--log.file.max-size <SIZE>
The maximum size (in MB) of one log file
Expand Down
2 changes: 1 addition & 1 deletion book/cli/reth/db/snapshot.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ Logging:
--log.file.directory <PATH>
The path to put log files in
[default: /home/doni/.config/cache/reth/logs]
[default: <CACHE_DIR>/logs]
--log.file.max-size <SIZE>
The maximum size (in MB) of one log file
Expand Down
2 changes: 1 addition & 1 deletion book/cli/reth/db/stats.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Logging:
--log.file.directory <PATH>
The path to put log files in
[default: /home/doni/.config/cache/reth/logs]
[default: <CACHE_DIR>/logs]
--log.file.max-size <SIZE>
The maximum size (in MB) of one log file
Expand Down
2 changes: 1 addition & 1 deletion book/cli/reth/db/version.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Logging:
--log.file.directory <PATH>
The path to put log files in
[default: /home/doni/.config/cache/reth/logs]
[default: <CACHE_DIR>/logs]
--log.file.max-size <SIZE>
The maximum size (in MB) of one log file
Expand Down
2 changes: 1 addition & 1 deletion book/cli/reth/debug.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Logging:
--log.file.directory <PATH>
The path to put log files in
[default: /home/doni/.config/cache/reth/logs]
[default: <CACHE_DIR>/logs]
--log.file.max-size <SIZE>
The maximum size (in MB) of one log file
Expand Down
2 changes: 1 addition & 1 deletion book/cli/reth/import.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Logging:
--log.file.directory <PATH>
The path to put log files in
[default: /home/doni/.config/cache/reth/logs]
[default: <CACHE_DIR>/logs]
--log.file.max-size <SIZE>
The maximum size (in MB) of one log file
Expand Down
2 changes: 1 addition & 1 deletion book/cli/reth/init.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Logging:
--log.file.directory <PATH>
The path to put log files in
[default: /home/doni/.config/cache/reth/logs]
[default: <CACHE_DIR>/logs]
--log.file.max-size <SIZE>
The maximum size (in MB) of one log file
Expand Down
8 changes: 4 additions & 4 deletions book/cli/reth/node.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ Networking:
--identity <IDENTITY>
Custom node identity
[default: reth/v0.1.0-alpha.13-5062b7ea8/x86_64-unknown-linux-gnu]
[default: reth/v0.1.0-alpha.13-82f7f45e/aarch64-apple-darwin]
--p2p-secret-key <PATH>
Secret key to use for this node.
Expand Down Expand Up @@ -173,7 +173,7 @@ RPC:
--ipcpath <IPCPATH>
Filename for IPC socket/pipe within the datadir
[default: /tmp/reth.ipc]
[default: <CACHE_DIR>.ipc]
--authrpc.addr <AUTH_ADDR>
Auth server address to listen on
Expand Down Expand Up @@ -333,7 +333,7 @@ Builder:
--builder.extradata <EXTRADATA>
Block extra data set by the payload builder
[default: reth/v0.1.0-alpha.13/linux]
[default: reth/v0.1.0-alpha.13/macos]
--builder.gaslimit <GAS_LIMIT>
Target gas ceiling for built blocks
Expand Down Expand Up @@ -425,7 +425,7 @@ Logging:
--log.file.directory <PATH>
The path to put log files in
[default: /home/doni/.config/cache/reth/logs]
[default: <CACHE_DIR>/logs]
--log.file.max-size <SIZE>
The maximum size (in MB) of one log file
Expand Down
2 changes: 1 addition & 1 deletion book/cli/reth/p2p.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ Logging:
--log.file.directory <PATH>
The path to put log files in
[default: /home/doni/.config/cache/reth/logs]
[default: <CACHE_DIR>/logs]
--log.file.max-size <SIZE>
The maximum size (in MB) of one log file
Expand Down
2 changes: 1 addition & 1 deletion book/cli/reth/p2p/body.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Logging:
--log.file.directory <PATH>
The path to put log files in
[default: /home/doni/.config/cache/reth/logs]
[default: <CACHE_DIR>/logs]
--log.file.max-size <SIZE>
The maximum size (in MB) of one log file
Expand Down
2 changes: 1 addition & 1 deletion book/cli/reth/p2p/header.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Logging:
--log.file.directory <PATH>
The path to put log files in
[default: /home/doni/.config/cache/reth/logs]
[default: <CACHE_DIR>/logs]
--log.file.max-size <SIZE>
The maximum size (in MB) of one log file
Expand Down
2 changes: 1 addition & 1 deletion book/cli/reth/recover.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Logging:
--log.file.directory <PATH>
The path to put log files in
[default: /home/doni/.config/cache/reth/logs]
[default: <CACHE_DIR>/logs]
--log.file.max-size <SIZE>
The maximum size (in MB) of one log file
Expand Down
2 changes: 1 addition & 1 deletion book/cli/reth/recover/storage-tries.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Logging:
--log.file.directory <PATH>
The path to put log files in
[default: /home/doni/.config/cache/reth/logs]
[default: <CACHE_DIR>/logs]
--log.file.max-size <SIZE>
The maximum size (in MB) of one log file
Expand Down
2 changes: 1 addition & 1 deletion book/cli/reth/stage.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Logging:
--log.file.directory <PATH>
The path to put log files in

[default: /home/doni/.config/cache/reth/logs]
[default: <CACHE_DIR>/logs]

--log.file.max-size <SIZE>
The maximum size (in MB) of one log file
Expand Down
2 changes: 1 addition & 1 deletion book/cli/reth/stage/drop.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Logging:
--log.file.directory <PATH>
The path to put log files in
[default: /home/doni/.config/cache/reth/logs]
[default: <CACHE_DIR>/logs]
--log.file.max-size <SIZE>
The maximum size (in MB) of one log file
Expand Down
2 changes: 1 addition & 1 deletion book/cli/reth/stage/dump.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Logging:
--log.file.directory <PATH>
The path to put log files in
[default: /home/doni/.config/cache/reth/logs]
[default: <CACHE_DIR>/logs]
--log.file.max-size <SIZE>
The maximum size (in MB) of one log file
Expand Down
2 changes: 1 addition & 1 deletion book/cli/reth/stage/dump/account-hashing.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Logging:
--log.file.directory <PATH>
The path to put log files in
[default: /home/doni/.config/cache/reth/logs]
[default: <CACHE_DIR>/logs]
--log.file.max-size <SIZE>
The maximum size (in MB) of one log file
Expand Down
2 changes: 1 addition & 1 deletion book/cli/reth/stage/dump/execution.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Logging:
--log.file.directory <PATH>
The path to put log files in
[default: /home/doni/.config/cache/reth/logs]
[default: <CACHE_DIR>/logs]
--log.file.max-size <SIZE>
The maximum size (in MB) of one log file
Expand Down
2 changes: 1 addition & 1 deletion book/cli/reth/stage/dump/merkle.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Logging:
--log.file.directory <PATH>
The path to put log files in
[default: /home/doni/.config/cache/reth/logs]
[default: <CACHE_DIR>/logs]
--log.file.max-size <SIZE>
The maximum size (in MB) of one log file
Expand Down
2 changes: 1 addition & 1 deletion book/cli/reth/stage/dump/storage-hashing.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Logging:
--log.file.directory <PATH>
The path to put log files in
[default: /home/doni/.config/cache/reth/logs]
[default: <CACHE_DIR>/logs]
--log.file.max-size <SIZE>
The maximum size (in MB) of one log file
Expand Down
4 changes: 2 additions & 2 deletions book/cli/reth/stage/run.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ Networking:
--identity <IDENTITY>
Custom node identity

[default: reth/v0.1.0-alpha.13-5062b7ea8/x86_64-unknown-linux-gnu]
[default: reth/v0.1.0-alpha.13-82f7f45e/aarch64-apple-darwin]

--p2p-secret-key <PATH>
Secret key to use for this node.
Expand Down Expand Up @@ -163,7 +163,7 @@ Logging:
--log.file.directory <PATH>
The path to put log files in

[default: /home/doni/.config/cache/reth/logs]
[default: <CACHE_DIR>/logs]

--log.file.max-size <SIZE>
The maximum size (in MB) of one log file
Expand Down
2 changes: 1 addition & 1 deletion book/cli/reth/stage/unwind.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Logging:
--log.file.directory <PATH>
The path to put log files in
[default: /home/doni/.config/cache/reth/logs]
[default: <CACHE_DIR>/logs]
--log.file.max-size <SIZE>
The maximum size (in MB) of one log file
Expand Down
2 changes: 1 addition & 1 deletion book/cli/reth/stage/unwind/num-blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Logging:
--log.file.directory <PATH>
The path to put log files in
[default: /home/doni/.config/cache/reth/logs]
[default: <CACHE_DIR>/logs]
--log.file.max-size <SIZE>
The maximum size (in MB) of one log file
Expand Down
2 changes: 1 addition & 1 deletion book/cli/reth/stage/unwind/to-block.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Logging:
--log.file.directory <PATH>
The path to put log files in
[default: /home/doni/.config/cache/reth/logs]
[default: <CACHE_DIR>/logs]
--log.file.max-size <SIZE>
The maximum size (in MB) of one log file
Expand Down
2 changes: 1 addition & 1 deletion book/cli/reth/test-vectors.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Logging:
--log.file.directory <PATH>
The path to put log files in
[default: /home/doni/.config/cache/reth/logs]
[default: <CACHE_DIR>/logs]
--log.file.max-size <SIZE>
The maximum size (in MB) of one log file
Expand Down
2 changes: 1 addition & 1 deletion book/cli/reth/test-vectors/tables.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Logging:
--log.file.directory <PATH>
The path to put log files in
[default: /home/doni/.config/cache/reth/logs]
[default: <CACHE_DIR>/logs]
--log.file.max-size <SIZE>
The maximum size (in MB) of one log file
Expand Down

0 comments on commit 5f691ea

Please sign in to comment.