Skip to content

Commit

Permalink
Removed all short flags and updated CLI commands comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ljoss17 committed Jun 8, 2022
1 parent 612a707 commit 88474db
Show file tree
Hide file tree
Showing 29 changed files with 45 additions and 101 deletions.
7 changes: 1 addition & 6 deletions relayer-cli/src/commands/clear.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,7 @@ pub struct ClearPacketsCmd {
#[clap(long = "chain", required = true, help = "identifier of the chain")]
chain_id: ChainId,

#[clap(
short = 'p',
long = "port",
required = true,
help = "identifier of the port"
)]
#[clap(long = "port", required = true, help = "identifier of the port")]
port_id: PortId,

#[clap(long = "chan", required = true, help = "identifier of the channel")]
Expand Down
11 changes: 6 additions & 5 deletions relayer-cli/src/commands/create/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ static HINT: &str = "Consider using the default invocation\n\nhermes create chan
///
/// There are two possible ways to invoke this command:
///
/// `create channel --port-a <Port-ID> --port-b <Port-ID> <Chain-A-ID> <Connection-ID>` is the default
/// `create channel --chain-a <Chain-A-ID> --conn-a <Connection-ID> --port-a <Port-ID> --port-b <Port-ID>` is the default
/// way in which this command should be used, specifying a `Connection-ID` for this new channel
/// to re-use. The command expects that `Connection-ID` is associated with chain A.
///
/// `create channel --port-a <Port-ID> --port-b <Port-ID> <Chain-A-ID> <Chain-B-ID> --new-client-connection`
/// `create channel --chain-a <Chain-A-ID> --chain-b <Chain-B-ID> --port-a <Port-ID> --port-b <Port-ID> --new-client-conn`
/// to indicate that a new connection/client pair is being created as part of this new channel.
/// This brings up an interactive yes/no prompt to ensure that the operator at least
/// considers the fact that they're initializing a new connection with the channel.
Expand All @@ -57,7 +57,10 @@ pub struct CreateChannelCommand {
)]
chain_b: Option<ChainId>,

/// Identifier of the connection on chain `a` to use in creating the new channel.
#[clap(
long = "conn-a",
help = "Identifier of the connection on chain `a` to use in creating the new channel."
)]
connection_a: Option<ConnectionId>,

#[clap(
Expand All @@ -75,15 +78,13 @@ pub struct CreateChannelCommand {
port_b: PortId,

#[clap(
short = 'o',
long = "order",
help = "The channel ordering, valid options 'unordered' (default) and 'ordered'",
default_value_t
)]
order: Order,

#[clap(
short = 'v',
long = "chan-version",
alias = "version",
help = "The version for the new channel"
Expand Down
6 changes: 3 additions & 3 deletions relayer-cli/src/commands/create/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ pub struct CreateConnectionCommand {
delay: u64,
}

// cargo run --bin hermes -- create connection ibc-0 ibc-1
// cargo run --bin hermes -- create connection ibc-0 ibc-1 --delay 100
// cargo run --bin hermes -- create connection ibc-0 --client-a-id 07-tendermint-0 --client-b-id 07-tendermint-0
// cargo run --bin hermes -- create connection --chain-a ibc-0 --chain-b ibc-1
// cargo run --bin hermes -- create connection --chain-a ibc-0 --chain-b ibc-1 --delay 100
// cargo run --bin hermes -- create connection --chain-a ibc-0 --client-a 07-tendermint-0 --client-b 07-tendermint-0
impl Runnable for CreateConnectionCommand {
fn run(&self) {
match &self.chain_b_id {
Expand Down
10 changes: 3 additions & 7 deletions relayer-cli/src/commands/keys/add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ use crate::conclude::Output;
///
/// The command to add a key from a file:
///
/// `keys add [OPTIONS] --key-file <KEY_FILE> <CHAIN_ID>`
/// `keys add [OPTIONS] --chain <CHAIN_ID> --key-file <KEY_FILE>`
///
/// The command to restore a key from a file containing mnemonic:
///
/// `keys add [OPTIONS] --mnemonic-file <MNEMONIC_FILE> <CHAIN_ID>`
/// `keys add [OPTIONS] --chain <CHAIN_ID> --mnemonic-file <MNEMONIC_FILE>`
///
/// The key-file and mnemonic-file flags can't be given at the same time, this will cause a terminating error.
/// If successful the key will be created or restored, depending on which flag was given.
Expand All @@ -36,7 +36,6 @@ pub struct KeysAddCmd {
chain_id: ChainId,

#[clap(
short = 'f',
long = "key-file",
required = true,
help = "path to the key file",
Expand All @@ -45,7 +44,6 @@ pub struct KeysAddCmd {
key_file: Option<PathBuf>,

#[clap(
short = 'm',
long = "mnemonic-file",
required = true,
help = "path to file containing mnemonic to restore the key from",
Expand All @@ -54,14 +52,12 @@ pub struct KeysAddCmd {
mnemonic_file: Option<PathBuf>,

#[clap(
short = 'k',
long = "key-name",
help = "name of the key (defaults to the `key_name` defined in the config)"
)]
key_name: Option<String>,

#[clap(
short = 'p',
long = "hd-path",
help = "derivation path for this key",
default_value = "m/44'/118'/0'/0/0"
Expand Down Expand Up @@ -107,7 +103,7 @@ impl Runnable for KeysAddCmd {
Ok(result) => result,
};

// Check if --file or --mnemonic was given as input.
// Check if --key-file or --mnemonic-file was given as input.
match (self.key_file.clone(), self.mnemonic_file.clone()) {
(Some(key_file), _) => {
let key = add_key(&opts.config, &opts.name, &key_file, &opts.hd_path);
Expand Down
3 changes: 1 addition & 2 deletions relayer-cli/src/commands/keys/balance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use crate::conclude::{exit_with_unrecoverable_error, json, Output};
///
/// The command has one argument and one optional flag:
///
/// `keys balance <chain_id> --key-name <KEY_NAME>`
/// `keys balance --chain <chain_id> --key-name <KEY_NAME>`
///
/// If no key name is given, it will be taken from the configuration file.
/// If successful the balance and denominator of the account, associated with the key name
Expand All @@ -23,7 +23,6 @@ pub struct KeyBalanceCmd {
chain_id: ChainId,

#[clap(
short = 'k',
long = "key-name",
help = "(optional) name of the key (defaults to the `key_name` defined in the config)"
)]
Expand Down
4 changes: 2 additions & 2 deletions relayer-cli/src/commands/keys/delete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ pub struct KeysDeleteCmd {
#[clap(long = "chain", required = true, help = "identifier of the chain")]
chain_id: ChainId,

#[clap(short = 'k', long = "key-name", help = "name of the key")]
#[clap(long = "key-name", help = "name of the key")]
key_name: Option<String>,

#[clap(short = 'a', long = "all", help = "delete all keys")]
#[clap(long = "all", help = "delete all keys")]
all: bool,
}

Expand Down
3 changes: 2 additions & 1 deletion relayer-cli/src/commands/listen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,12 @@ impl FromStr for EventFilter {
#[derive(Debug, Parser)]
pub struct ListenCmd {
/// Identifier of the chain to listen for events from
#[clap(long = "chain", required = true)]
chain_id: ChainId,

/// Add an event type to listen for, can be repeated.
/// Listen for all events by default (available: Tx, NewBlock).
#[clap(short = 'e', long = "event", value_name = "EVENT")]
#[clap(long = "event", value_name = "EVENT")]
events: Vec<EventFilter>,
}

Expand Down
3 changes: 1 addition & 2 deletions relayer-cli/src/commands/query/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ pub struct QueryChannelEndCmd {
chain_id: ChainId,

#[clap(
short = 'p',
long = "port",
required = true,
help = "identifier of the port to query"
Expand All @@ -37,7 +36,7 @@ pub struct QueryChannelEndCmd {
)]
channel_id: ChannelId,

#[clap(short = 'H', long = "height", help = "height of the state to query")]
#[clap(long = "height", help = "height of the state to query")]
height: Option<u64>,
}

Expand Down
3 changes: 1 addition & 2 deletions relayer-cli/src/commands/query/channel_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use crate::conclude::{exit_with_unrecoverable_error, Output};

/// The data structure that represents the arguments when invoking the `query channel client` CLI command.
///
/// `query channel client --port-id <port_id> --channel-id <channel_id> <chain_id>`
/// `query channel client --chain <chain_id> --port <port_id> --chan <channel_id>`
///
/// If successful the channel's client state is displayed.
#[derive(Clone, Command, Debug, Parser)]
Expand All @@ -24,7 +24,6 @@ pub struct QueryChannelClientCmd {
chain_id: ChainId,

#[clap(
short = 'p',
long = "port",
required = true,
help = "identifier of the port to query"
Expand Down
3 changes: 1 addition & 2 deletions relayer-cli/src/commands/query/channel_ends.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,10 @@ pub struct QueryChannelEndsCmd {
)]
channel_id: ChannelId,

#[clap(short = 'H', long = "height", help = "height of the state to query")]
#[clap(long = "height", help = "height of the state to query")]
height: Option<u64>,

#[clap(
short = 'v',
long = "verbose",
help = "enable verbose output, displaying all details of channels, connections & clients"
)]
Expand Down
2 changes: 0 additions & 2 deletions relayer-cli/src/commands/query/channels.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,12 @@ pub struct QueryChannelsCmd {
chain_id: ChainId,

#[clap(
short = 'd',
long = "dst-chain",
help = "identifier of the channel's destination chain"
)]
dst_chain_id: Option<ChainId>,

#[clap(
short = 'v',
long = "verbose",
help = "enable verbose output, displaying all client and connection ids"
)]
Expand Down
28 changes: 7 additions & 21 deletions relayer-cli/src/commands/query/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,12 @@ pub struct QueryClientStateCmd {
)]
client_id: ClientId,

#[clap(
short = 'H',
long = "height",
help = "the chain height context for the query"
)]
#[clap(long = "height", help = "the chain height context for the query")]
height: Option<u64>,
}

/// Command for querying a client's state.
/// hermes query client state ibc-1 07-tendermint-0 --height 3
/// hermes query client state --chain ibc-1 --client 07-tendermint-0 --height 3
impl Runnable for QueryClientStateCmd {
fn run(&self) {
let config = app_config();
Expand Down Expand Up @@ -100,23 +96,18 @@ pub struct QueryClientConsensusCmd {
)]
consensus_height: Option<u64>,

#[clap(
short = 's',
long = "heights-only",
help = "show only consensus heights"
)]
#[clap(long = "heights-only", help = "show only consensus heights")]
heights_only: bool,

#[clap(
short = 'H',
long = "height",
help = "the chain height context to be used, applicable only to a specific height"
)]
height: Option<u64>,
}

/// Implementation of the query for a client's consensus state at a certain height.
/// hermes query client consensus ibc-0 07-tendermint-0 -c 22
/// hermes query client consensus --chain ibc-0 --client 07-tendermint-0 --consensus-height 22
impl Runnable for QueryClientConsensusCmd {
fn run(&self) {
let config = app_config();
Expand Down Expand Up @@ -209,16 +200,12 @@ pub struct QueryClientHeaderCmd {
)]
consensus_height: u64,

#[clap(
short = 'H',
long = "height",
help = "the chain height context for the query"
)]
#[clap(long = "height", help = "the chain height context for the query")]
height: Option<u64>,
}

/// Implementation of the query for the header used in a client update at a certain height.
/// hermes query client header ibc-0 07-tendermint-0 22
/// hermes query client header --chain ibc-0 --client 07-tendermint-0 --consensus-height 22
impl Runnable for QueryClientHeaderCmd {
fn run(&self) {
let config = app_config();
Expand Down Expand Up @@ -286,14 +273,13 @@ pub struct QueryClientConnectionsCmd {
client_id: ClientId,

#[clap(
short = 'H',
long = "height",
help = "the chain height which this query should reflect"
)]
height: Option<u64>,
}

// hermes query connections ibc-0
// hermes query connections --chain ibc-0
impl Runnable for QueryClientConnectionsCmd {
fn run(&self) {
let config = app_config();
Expand Down
4 changes: 1 addition & 3 deletions relayer-cli/src/commands/query/clients.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,13 @@ pub struct QueryAllClientsCmd {
chain_id: ChainId,

#[clap(
short = 's',
long = "src-chain",
help = "filter for clients which target a specific chain id (implies '-o')",
value_name = "ID"
)]
src_chain_id: Option<ChainId>,

#[clap(
short = 'o',
long = "omit-chain-ids",
help = "omit printing the source chain for each client"
)]
Expand All @@ -47,7 +45,7 @@ struct ClientChain {
}

/// Command for querying all clients.
/// hermes -c cfg.toml query clients ibc-1
/// hermes --config cfg.toml query clients --chain ibc-1
impl Runnable for QueryAllClientsCmd {
fn run(&self) {
let config = app_config();
Expand Down
4 changes: 2 additions & 2 deletions relayer-cli/src/commands/query/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ pub struct QueryConnectionEndCmd {
)]
connection_id: ConnectionId,

#[clap(short = 'H', long = "height", help = "height of the state to query")]
#[clap(long = "height", help = "height of the state to query")]
height: Option<u64>,
}

// cargo run --bin hermes -- query connection end ibc-test connectionidone --height 3
// cargo run --bin hermes -- query connection end --chain ibc-test --conn connectionidone --height 3
impl Runnable for QueryConnectionEndCmd {
fn run(&self) {
let config = app_config();
Expand Down
3 changes: 1 addition & 2 deletions relayer-cli/src/commands/query/packet/ack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ pub struct QueryPacketAcknowledgmentCmd {
chain_id: ChainId,

#[clap(
short = 'p',
long = "port",
required = true,
help = "identifier of the port to query"
Expand All @@ -39,7 +38,7 @@ pub struct QueryPacketAcknowledgmentCmd {
#[clap(long = "seq", required = true, help = "sequence of packet to query")]
sequence: Sequence,

#[clap(short = 'H', long = "height", help = "height of the state to query")]
#[clap(long = "height", help = "height of the state to query")]
height: Option<u64>,
}

Expand Down
3 changes: 1 addition & 2 deletions relayer-cli/src/commands/query/packet/acks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ pub struct QueryPacketAcknowledgementsCmd {
chain_id: ChainId,

#[clap(
short = 'p',
long = "port",
required = true,
help = "identifier of the port to query"
Expand Down Expand Up @@ -65,7 +64,7 @@ impl QueryPacketAcknowledgementsCmd {
}
}

// cargo run --bin hermes -- query packet acknowledgements ibc-0 transfer ibconexfer --height 3
// cargo run --bin hermes -- query packet acknowledgements --chain ibc-0 --port transfer --conn ibconexfer --height 3
impl Runnable for QueryPacketAcknowledgementsCmd {
fn run(&self) {
match self.execute() {
Expand Down
3 changes: 1 addition & 2 deletions relayer-cli/src/commands/query/packet/commitment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ pub struct QueryPacketCommitmentCmd {
chain_id: ChainId,

#[clap(
short = 'p',
long = "port",
required = true,
help = "identifier of the port to query"
Expand All @@ -46,7 +45,7 @@ pub struct QueryPacketCommitmentCmd {
#[clap(long = "seq", required = true, help = "sequence of packet to query")]
sequence: Sequence,

#[clap(short = 'H', long = "height", help = "height of the state to query")]
#[clap(long = "height", help = "height of the state to query")]
height: Option<u64>,
}

Expand Down
Loading

0 comments on commit 88474db

Please sign in to comment.