Skip to content

Commit

Permalink
doc
Browse files Browse the repository at this point in the history
  • Loading branch information
haxjump committed Oct 9, 2024
1 parent 3a07c52 commit be90191
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 54 deletions.
96 changes: 52 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@ source ~/.bashrc

```shell
# nbnet -h

Usage: nbnet <COMMAND>

Commands:
dev Manage development clusters on local host
ddev Manage development clusters on remote hosts
help Print this message or the help of the given subcommand(s)
dev Manage development clusters on a local host
ddev Manage development clusters on various distributed hosts
gen-zsh-completions, -z Generate the cmdline completion script for zsh
gen-bash-completions, -b Generate the cmdline completion script for bash
help Print this message or the help of the given subcommand(s)

Options:
-h, --help Print help
Expand All @@ -35,27 +36,30 @@ Options:

```shell
# nbnet dev -h

Manage development clusters on a local host

Usage: nbnet dev [OPTIONS] [COMMAND]

Commands:
create Create a new ENV
destroy Destroy an existing ENV
destroy-all Destroy all existing ENVs
protect Protect an existing ENV
unprotect Unprotect an existing ENV
start Start an existing ENV
start-all Start all existing ENVs
stop Stop an existing ENV
stop-all Stop all existing ENVs
push-node Push a new node to an existing ENV
kick-node Remove an existing node from an existing ENV
show Default operation, show the information of an existing ENV
show-all Show informations of all existing ENVs
list Show names of all existing ENVs
help Print this message or the help of the given subcommand(s)
create Create a new ENV
destroy Destroy an existing ENV
destroy-all Destroy all existing ENVs
protect Protect an existing ENV
unprotect Unprotect an existing ENV
start Start an existing ENV
start-all Start all existing ENVs
stop Stop an existing ENV
stop-all Stop all existing ENVs
push-node Push a new node to an existing ENV
kick-node Remove an existing node from an existing ENV
switch-EL-to-geth Switch the EL client to `geth`,
NOTE: the node will be left stopped, a `start` operation may be needed
switch-EL-to-reth Switch the EL client to `reth`,
NOTE: the node will be left stopped, a `start` operation may be needed
show Default operation, show the information of an existing ENV
show-all Show informations of all existing ENVs
list Show names of all existing ENVs
help Print this message or the help of the given subcommand(s)

Options:
-e, --env-name <ENV_NAME>
Expand All @@ -64,35 +68,39 @@ Options:

```shell
# nbnet ddev -h

Manage development clusters on various distributed hosts

Usage: nbnet ddev [OPTIONS] [COMMAND]

Commands:
create Create a new ENV
destroy Destroy an existing ENV
destroy-all Destroy all existing ENVs
protect Protect an existing ENV
unprotect Unprotect an existing ENV
start Start an existing ENV
start-all Start all existing ENVs
stop Stop an existing ENV
stop-all Stop all existing ENVs
push-node Push a new node to an existing ENV
migrate-node Migrate an existing node to another host
kick-node Remove an existing node from an existing ENV
push-host Add a new host to the cluster
kick-host Remove a host from the cluster
show Default operation, show the information of an existing ENV
show-all Show informations of all existing ENVs
list Show names of all existing ENVs
host-put-file Put a local file to all remote hosts
host-get-file Get a remote file from all remote hosts
host-exec Execute commands on all remote hosts
get-logs Get the remote logs from all nodes of the ENV
dump-vc-data Dump the validator client data from all nodes of the ENV
help Print this message or the help of the given subcommand(s)
create Create a new ENV
destroy Destroy an existing ENV
destroy-all Destroy all existing ENVs
protect Protect an existing ENV
unprotect Unprotect an existing ENV
start Start an existing ENV
start-all Start all existing ENVs
stop Stop an existing ENV
stop-all Stop all existing ENVs
push-node Push a new node to an existing ENV
migrate-node Migrate an existing node to another host,
NOTE: the node will be left stopped, a `start` operation may be needed
kick-node Remove an existing node from an existing ENV
switch-EL-to-geth Switch the EL client to `geth`,
NOTE: the node will be left stopped, a `start` operation may be needed
switch-EL-to-reth Switch the EL client to `reth`,
NOTE: the node will be left stopped, a `start` operation may be needed
push-host Add a new host to the cluster
kick-host Remove a host from the cluster
show Default operation, show the information of an existing ENV
show-all Show informations of all existing ENVs
list Show names of all existing ENVs
host-put-file Put a local file to all remote hosts
host-get-file Get a remote file from all remote hosts
host-exec Execute commands on all remote hosts
get-logs Get the remote logs from all nodes of the ENV
dump-vc-data Dump the validator client data from all nodes of the ENV
help Print this message or the help of the given subcommand(s)

Options:
-e, --env-name <ENV_NAME>
Expand Down
3 changes: 2 additions & 1 deletion src/cfg/hosts.format
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Example B:
Only the `host_ip` field is mandatory, the others are optional;
If the `external_ip` is missing, will fallback to the `host_ip` for external connections;
All whitespace characters(\n,\t, etc.) will be removed before parsing the value;
The `host_weight` should be a positive number(1~10), the default value is 5,
The `host_weight` should be a positive number(1~255),
if not set, the number of CPU threads on the host will be used,
the larger the number, the more nodes the host will carry;
The configuration here will override the `$NBNET_DDEV_HOSTS` settings.
27 changes: 18 additions & 9 deletions src/cfg/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,15 @@ pub enum Commands {
about = "Manage development clusters on various distributed hosts"
)]
DDev(DDevCfg),
#[clap(short_flag = 'z', about = "Generate cmdline completions and zsh")]
#[clap(
short_flag = 'z',
about = "Generate the cmdline completion script for zsh"
)]
GenZshCompletions,
#[clap(short_flag = 'b', about = "Generate cmdline completions and bash")]
#[clap(
short_flag = 'b',
about = "Generate the cmdline completion script for bash"
)]
GenBashCompletions,
}

Expand Down Expand Up @@ -94,7 +100,8 @@ pub enum DevOp {
},
#[clap(
name = "switch-EL-to-geth",
about = "Switch the EL client to `geth`, NOTE: the node will be left stopped, you need to start it manually"
about = "Switch the EL client to `geth`,
NOTE: the node will be left stopped, a `start` operation may be needed"
)]
SwitchELToGeth {
#[clap(short = 'e', long)]
Expand All @@ -104,7 +111,8 @@ pub enum DevOp {
},
#[clap(
name = "switch-EL-to-reth",
about = "Switch the EL client to `reth`, NOTE: the node will be left stopped, you need to start it manually"
about = "Switch the EL client to `reth`,
NOTE: the node will be left stopped, a `start` operation may be needed"
)]
SwitchELToReth {
#[clap(short = 'e', long)]
Expand Down Expand Up @@ -283,9 +291,8 @@ pub enum DDevOp {
#[clap(long, help = "To get a archive node, set true")]
is_archive: bool,
},
#[clap(
about = "Migrate an existing node to another host, NOTE: the node will be left stopped, you need to start it manually"
)]
#[clap(about = "Migrate an existing node to another host,
NOTE: the node will be left stopped, a `start` operation may be needed")]
MigrateNode {
#[clap(short = 'e', long)]
env_name: Option<String>,
Expand All @@ -303,7 +310,8 @@ pub enum DDevOp {
},
#[clap(
name = "switch-EL-to-geth",
about = "Switch the EL client to `geth`, NOTE: the node will be left stopped, you need to start it manually"
about = "Switch the EL client to `geth`,
NOTE: the node will be left stopped, a `start` operation may be needed"
)]
SwitchELToGeth {
#[clap(short = 'e', long)]
Expand All @@ -313,7 +321,8 @@ pub enum DDevOp {
},
#[clap(
name = "switch-EL-to-reth",
about = "Switch the EL client to `reth`, NOTE: the node will be left stopped, you need to start it manually"
about = "Switch the EL client to `reth`,
NOTE: the node will be left stopped, a `start` operation may be needed"
)]
SwitchELToReth {
#[clap(short = 'e', long)]
Expand Down

0 comments on commit be90191

Please sign in to comment.