Skip to content

Commit

Permalink
Rename application-handled -h CLI flags to -H (informalsystems#1743)
Browse files Browse the repository at this point in the history
* Disambiguate between help and height flags by using `-H` for the latter

* Enable clap-provided help flags on all subcommands

Since all application-assigned short -h options have been renamed to -H,
there is no need to suppress the -h flags provided by clap with the
DisableHelpFlag setting.

* Update changelog for informalsystems#1743

* Remove a FIXME comment

Resolved by e59bb13

Co-authored-by: Romain Ruetschi <romain@informal.systems>
  • Loading branch information
mzabaluev and romac authored Jan 7, 2022
1 parent fd1a5f8 commit 1e95948
Show file tree
Hide file tree
Showing 14 changed files with 24 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
`--help` flags in subcommands and improving help and usage printouts.
The `--version` option of the `create channel` subcommand has been renamed
to `--channel-version`, with the old name still supported as an alias.
([#1576](https://github.com/informalsystems/ibc-rs/pull/1576))
([#1576](https://github.com/informalsystems/ibc-rs/pull/1576),
[#1743](https://github.com/informalsystems/ibc-rs/pull/1743))
2 changes: 1 addition & 1 deletion guide/src/commands/path-setup/clients.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ POSITIONAL ARGUMENTS:
dst_client_id identifier of the client to be updated on destination chain

FLAGS:
-h, --target-height TARGET-HEIGHT
-H, --target-height TARGET-HEIGHT
-t, --trusted-height TRUSTED-HEIGHT
```

Expand Down
6 changes: 3 additions & 3 deletions guide/src/commands/queries/channel.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ POSITIONAL ARGUMENTS:
channel_id identifier of the channel to query

FLAGS:
-h, --height HEIGHT height of the state to query
-H, --height HEIGHT height of the state to query
```

__Example__
Expand Down Expand Up @@ -131,7 +131,7 @@ POSITIONAL ARGUMENTS:
channel_id identifier of the channel to query

FLAGS:
-h, --height HEIGHT height of the state to query
-H, --height HEIGHT height of the state to query
-v, --verbose enable verbose output, displaying all details of channels, connections & clients
```

Expand Down Expand Up @@ -181,4 +181,4 @@ Success: ChannelEndsSummary {
```

Passing the `-v` flag will additionally print all the details of the
channel, connection, and client on both ends.
channel, connection, and client on both ends.
8 changes: 4 additions & 4 deletions guide/src/commands/queries/client.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ POSITIONAL ARGUMENTS:
client_id identifier of the client to query

FLAGS:
-h, --height HEIGHT the chain height which this query should reflect
-H, --height HEIGHT the chain height which this query should reflect
```

__Example__
Expand Down Expand Up @@ -159,7 +159,7 @@ POSITIONAL ARGUMENTS:
FLAGS:
-c, --consensus-height CONSENSUS-HEIGHT
-s, --heights-only show only consensus heights
-h, --height HEIGHT the chain height context to be used, applicable only to a specific height
-H, --height HEIGHT the chain height context to be used, applicable only to a specific height
```

__Example__
Expand Down Expand Up @@ -235,7 +235,7 @@ POSITIONAL ARGUMENTS:
client_id identifier of the client to query

FLAGS:
-h, --height HEIGHT the chain height which this query should reflect
-H, --height HEIGHT the chain height which this query should reflect
```

__Example__
Expand Down Expand Up @@ -268,7 +268,7 @@ POSITIONAL ARGUMENTS:
consensus_height height of header to query
FLAGS:
-h, --height HEIGHT the chain height context for the query
-H, --height HEIGHT the chain height context for the query
```

__Example__
Expand Down
2 changes: 1 addition & 1 deletion guide/src/commands/queries/connection.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ POSITIONAL ARGUMENTS:
connection_id identifier of the connection to query

FLAGS:
-h, --height HEIGHT height of the state to query
-H, --height HEIGHT height of the state to query
```

__Example__
Expand Down
4 changes: 2 additions & 2 deletions guide/src/commands/queries/packet.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ POSITIONAL ARGUMENTS:
sequence sequence of packet to query

FLAGS:
-h, --height HEIGHT height of the state to query
-H, --height HEIGHT height of the state to query
```

__Example__
Expand Down Expand Up @@ -154,7 +154,7 @@ POSITIONAL ARGUMENTS:
sequence sequence of packet to query

FLAGS:
-h, --height HEIGHT height of the state to query
-H, --height HEIGHT height of the state to query
```

__Example__
Expand Down
2 changes: 1 addition & 1 deletion guide/src/commands/raw/client.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ POSITIONAL ARGUMENTS:
dst_client_id identifier of the client to be updated on destination chain

FLAGS:
-h, --target-height TARGET-HEIGHT
-H, --target-height TARGET-HEIGHT
-t, --trusted-height TRUSTED-HEIGHT
```

Expand Down
5 changes: 1 addition & 4 deletions relayer-cli/src/commands/query/channel.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use alloc::sync::Arc;

use abscissa_core::{Clap, Command, Runnable};
use clap::AppSettings::DisableHelpFlag;
use tokio::runtime::Runtime as TokioRuntime;

use ibc::core::ics24_host::identifier::ChainId;
Expand All @@ -13,7 +12,6 @@ use crate::prelude::*;
use ibc::core::ics04_channel::channel::State;

#[derive(Clone, Command, Debug, Clap)]
#[clap(setting(DisableHelpFlag))]
pub struct QueryChannelEndCmd {
#[clap(required = true, about = "identifier of the chain to query")]
chain_id: ChainId,
Expand All @@ -24,8 +22,7 @@ pub struct QueryChannelEndCmd {
#[clap(required = true, about = "identifier of the channel to query")]
channel_id: ChannelId,

// FIXME: rename the short option to avoid confusion with --help?
#[clap(short = 'h', long, about = "height of the state to query")]
#[clap(short = 'H', long, about = "height of the state to query")]
height: Option<u64>,
}

Expand Down
5 changes: 1 addition & 4 deletions relayer-cli/src/commands/query/channel_ends.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use abscissa_core::{Clap, Command, Runnable};
use clap::AppSettings::DisableHelpFlag;
use serde::{Deserialize, Serialize};

use ibc::core::ics02_client::client_state::{AnyClientState, ClientState};
Expand All @@ -15,7 +14,6 @@ use crate::conclude::Output;
use crate::prelude::*;

#[derive(Clone, Command, Debug, Clap)]
#[clap(setting(DisableHelpFlag))]
pub struct QueryChannelEndsCmd {
#[clap(required = true, about = "identifier of the chain to query")]
chain_id: ChainId,
Expand All @@ -26,8 +24,7 @@ pub struct QueryChannelEndsCmd {
#[clap(required = true, about = "identifier of the channel to query")]
channel_id: ChannelId,

// FIXME: rename the short option to avoid confusion with --help?
#[clap(short = 'h', long, about = "height of the state to query")]
#[clap(short = 'H', long, about = "height of the state to query")]
height: Option<u64>,

#[clap(
Expand Down
13 changes: 4 additions & 9 deletions relayer-cli/src/commands/query/client.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use alloc::sync::Arc;

use abscissa_core::{Clap, Command, Runnable};
use clap::AppSettings::DisableHelpFlag;
use tokio::runtime::Runtime as TokioRuntime;
use tracing::debug;

Expand All @@ -22,16 +21,14 @@ use crate::conclude::{exit_with_unrecoverable_error, Output};

/// Query client state command
#[derive(Clone, Command, Debug, Clap)]
#[clap(setting(DisableHelpFlag))]
pub struct QueryClientStateCmd {
#[clap(required = true, about = "identifier of the chain to query")]
chain_id: ChainId,

#[clap(required = true, about = "identifier of the client to query")]
client_id: ClientId,

// FIXME: rename the short option to avoid confusion with --help?
#[clap(short = 'h', long, about = "the chain height context for the query")]
#[clap(short = 'H', long, about = "the chain height context for the query")]
height: Option<u64>,
}

Expand Down Expand Up @@ -84,7 +81,7 @@ pub struct QueryClientConsensusCmd {
heights_only: bool,

#[clap(
short = 'h',
short = 'H',
long,
about = "the chain height context to be used, applicable only to a specific height"
)]
Expand Down Expand Up @@ -161,7 +158,6 @@ impl Runnable for QueryClientConsensusCmd {
}

#[derive(Clone, Command, Debug, Clap)]
#[clap(setting(DisableHelpFlag))]
pub struct QueryClientHeaderCmd {
#[clap(required = true, about = "identifier of the chain to query")]
chain_id: ChainId,
Expand All @@ -172,8 +168,7 @@ pub struct QueryClientHeaderCmd {
#[clap(required = true, about = "height of header to query")]
consensus_height: u64,

// FIXME: rename the short option to avoid confusion with --help?
#[clap(short = 'h', long, about = "the chain height context for the query")]
#[clap(short = 'H', long, about = "the chain height context for the query")]
height: Option<u64>,
}

Expand Down Expand Up @@ -239,7 +234,7 @@ pub struct QueryClientConnectionsCmd {
client_id: ClientId,

#[clap(
short = 'h',
short = 'H',
long,
about = "the chain height which this query should reflect"
)]
Expand Down
5 changes: 1 addition & 4 deletions relayer-cli/src/commands/query/connection.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use alloc::sync::Arc;

use abscissa_core::{Clap, Command, Runnable};
use clap::AppSettings::DisableHelpFlag;
use tokio::runtime::Runtime as TokioRuntime;

use ibc::core::{
Expand All @@ -17,16 +16,14 @@ use crate::error::Error;
use crate::prelude::*;

#[derive(Clone, Command, Debug, Clap)]
#[clap(setting(DisableHelpFlag))]
pub struct QueryConnectionEndCmd {
#[clap(required = true, about = "identifier of the chain to query")]
chain_id: ChainId,

#[clap(required = true, about = "identifier of the connection to query")]
connection_id: ConnectionId,

// FIXME: rename the short option to avoid confusion with --help?
#[clap(short = 'h', long, about = "height of the state to query")]
#[clap(short = 'H', long, about = "height of the state to query")]
height: Option<u64>,
}

Expand Down
5 changes: 1 addition & 4 deletions relayer-cli/src/commands/query/packet/ack.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use abscissa_core::{Clap, Command, Runnable};
use clap::AppSettings::DisableHelpFlag;
use subtle_encoding::{Encoding, Hex};

use ibc::core::ics04_channel::packet::{PacketMsgType, Sequence};
Expand All @@ -13,7 +12,6 @@ use crate::error::Error;
use crate::prelude::*;

#[derive(Clone, Command, Debug, Clap)]
#[clap(setting(DisableHelpFlag))]
pub struct QueryPacketAcknowledgmentCmd {
#[clap(required = true, about = "identifier of the chain to query")]
chain_id: ChainId,
Expand All @@ -27,8 +25,7 @@ pub struct QueryPacketAcknowledgmentCmd {
#[clap(required = true, about = "sequence of packet to query")]
sequence: Sequence,

// FIXME: rename the short option to avoid confusion with --help?
#[clap(short = 'h', long, about = "height of the state to query")]
#[clap(short = 'H', long, about = "height of the state to query")]
height: Option<u64>,
}

Expand Down
5 changes: 1 addition & 4 deletions relayer-cli/src/commands/query/packet/commitment.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use abscissa_core::{Clap, Command, Runnable};
use clap::AppSettings::DisableHelpFlag;
use serde::Serialize;
use subtle_encoding::{Encoding, Hex};

Expand All @@ -20,7 +19,6 @@ struct PacketSeqs {
}

#[derive(Clone, Command, Debug, Clap)]
#[clap(setting(DisableHelpFlag))]
pub struct QueryPacketCommitmentCmd {
#[clap(required = true, about = "identifier of the chain to query")]
chain_id: ChainId,
Expand All @@ -34,8 +32,7 @@ pub struct QueryPacketCommitmentCmd {
#[clap(required = true, about = "sequence of packet to query")]
sequence: Sequence,

// FIXME: rename the short option to avoid confusion with --help?
#[clap(short = 'h', long, about = "height of the state to query")]
#[clap(short = 'H', long, about = "height of the state to query")]
height: Option<u64>,
}

Expand Down
5 changes: 1 addition & 4 deletions relayer-cli/src/commands/tx/client.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use core::fmt;

use abscissa_core::{Clap, Command, Runnable};
use clap::AppSettings::DisableHelpFlag;

use ibc::core::ics02_client::client_state::ClientState;
use ibc::core::ics24_host::identifier::{ChainId, ClientId};
Expand Down Expand Up @@ -55,7 +54,6 @@ impl Runnable for TxCreateClientCmd {
}

#[derive(Clone, Command, Debug, Clap)]
#[clap(setting(DisableHelpFlag))]
pub struct TxUpdateClientCmd {
#[clap(required = true, about = "identifier of the destination chain")]
dst_chain_id: ChainId,
Expand All @@ -66,8 +64,7 @@ pub struct TxUpdateClientCmd {
)]
dst_client_id: ClientId,

// FIXME: rename the short option to avoid confusion with --help?
#[clap(short = 'h', long, about = "the target height of the client update")]
#[clap(short = 'H', long, about = "the target height of the client update")]
target_height: Option<u64>,

#[clap(short = 't', long, about = "the trusted height of the client update")]
Expand Down

0 comments on commit 1e95948

Please sign in to comment.