Skip to content

CLI: Use flags everywhere instead of positional arguments #2239

Closed
@romac

Description

Summary

All CLI commands should use flags (--flag) options instead of positional arguments.

Problem Definition

At the moment, a lot of the CLI commands use a mix of positional arguments and flags, for example
the create channel CLI:

hermes create client ibc-1 ibc-0 --trusting-period 14days
                     ^^^^^ ^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^
                      positional          flag

When writing the commands it is now always clear what the positional arguments denote (eg. which is the source chain and destination chain), and one often has to resort to the command documentation (--help) to figure it out.

Even worse, the number of positional arguments and their denotation for the create channel command change depending on which flags are passed, eg.

hermes create channel ibc-0         -c ibc-1 --port-a transfer --port-b transfer --new-client-connection
                      ^^^^^         ^^^^^^^^ ^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^
                      positional    flag     flag              flag              flag

vs

hermes create channel  ibc-0       connection-0 --port-a transfer --port-b transfer
                       ^^^^^       ^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^
                    positional      positional        flag               flag

This is quite confusing, as expressed already by some operators: #1935

Proposal

I suggest using flags everywhere instead of positional arguments.

Positional arguments should be kept for the case where we want to pass a list of items to a command, which we don't have the need for currently.

Acceptance Criteria

All CLI commands accept only flags and no positional arguments.


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate milestone (priority) applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned

Metadata

Assignees

Labels

A: good-first-issueAdmin: good for newcomersI: CLIInternal: related to the relayer's CLIO: usabilityObjective: cause to improve the user experience (UX) and ease using the product

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions