Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep command interface #52

Closed
Shadowfiend opened this issue Mar 13, 2018 · 12 comments
Closed

Keep command interface #52

Shadowfiend opened this issue Mar 13, 2018 · 12 comments
Assignees
Labels
💻 interface The user interface: command-line invocation, packaging, etc.

Comments

@Shadowfiend
Copy link
Contributor

Shadowfiend commented Mar 13, 2018

In the form of --help docs:

keep-client [<option> ...] <subcommand>

<option> are:
  --config: pointer to the TOML config file
  --...: overrides for config settings?

Subcommands:
  start [<option> ...]
    Starts the Keep client in the foreground. Currently this consists of the
    threshold relay client for the Keep random beacon and the validator client
    for the Keep random beacon.

    --[no-]relay: Enables or disables the relay client; enabled by default.
    --[no-]provider: Enables or disables the Keep provider client; enabled
       by default.

  contract [<option> ...] <contract> [<arg> ...]
    Invokes the named <contract>, passing it the given <arg>s.

    <option> are:
      --call: default, calls the contract without submitting a tx, returns result
      --submit: submits a tx, does not return result
      --nonce <number>: force a nonce
      --address: specify an address to override existing config

  relay <subcommand>

    Subcommands:

    request [<option> ...]:
      issues a relay request and outputs the request id, then waits for
      relay entry to be returned and prints that as well

      <option> are:
        --request-only: only prints request id
        --entry-only: only prints entry
    entry <id>:
      looks up the entry for the given id and prints it

  stake <address> <amount>:
    Stakes the given amount of KEEP from the given address.
    can think about whether we want this one.

Want to build a quick prototype of this soon so we can actually run it and see how it feels.

See this discussion in Flowdock.

@rargulati
Copy link
Contributor

rargulati commented Mar 13, 2018

Quick initial 10min run through.

Usage: keep [<option> ...] COMMAND

Help topics, run 'keep COMMAND --help' for more details.

Options are:
  --config: pointer to the TOML config file
  --...: overrides for config settings?

Available commands are:
  start              Starts the Keep client in the foreground
  contract        Invokes the named contract.
  relay              CLI interface to issue and lookup relay requests and entries.
  stake             Interface to manage staked amount of KEEP.
❯ keep start --help
 Usage: start [<option> ...]
    Starts the Keep client in the foreground. Currently this consists of the
    threshold relay client for the Keep random beacon and the validator client
    for the Keep random beacon.

    --[no-]relay: Enables or disables the relay client; enabled by default.
    --[no-]relay-validator: Enables or disables the relay validator client;
      enabled by default.

  Definitions:
   ....
  Example:
   $ keep --config . start --relay
    2018-01-01T12:00:00+00:00 keep[relay]: Config add cfg.toml for address 0x....
    2018-01-01T12:00:01+00:00 keep[relay]: Initializing relay, validating stake for 0x...
    2018-01-01T12:00:01+00:00 keep[relay]: Stake validated for 1000 KEEP, waiting for group...
❯ keep contract --help
  Usage: contract [<option> ...] <contract> [<arg> ...]
    Invokes the named <contract>, passing it the given <arg>s.

    <option> are:
      --call: default, calls the contract without submitting a tx, returns result
      --submit: submits a tx, does not return result
      --nonce <number>: force a nonce
      --address: specify an address to override existing config

   Definitions:
    ...
   Example:
     ...

I didn't do much with this one as it will require a bit more thought...

❯ keep relay --help
  Usage: relay <subcommand>

    Some tldr of what relay does

    Subcommands:
    request [<option> ...]:
      issues a relay request and outputs the request id, then waits for
      relay entry to be returned and prints that as well

      <option> are:
        --request-only: only prints request id
        --entry-only: only prints entry
    entry <id>:
      looks up the entry for the given id and prints it

   Definitions:
    ...
   Example:
     ...

❯ keep stake --help
  Usage: stake <address> <amount>

    Stakes the given amount of KEEP from the given address.

   Definitions:
    ...
   Example:
       $ keep stake 0x... 1000
       2018-01-01T12:00:01+00:00 keep[stake]: Staked 1000 KEEP for address 0x...

@Shadowfiend
Copy link
Contributor Author

Hmm… What was the goal there? Are you showing what the interactions would look like? Or did you have thoughts on what you like and don't like about that interface?

@rargulati
Copy link
Contributor

rargulati commented Mar 13, 2018

Lots of great Golang tooling for command line interfaces. You can get really far with the flag package. That being said, things get hairy QUICK, especially if you want to do anything unique or if you forget to standardize/drive consistency.

Cobra, urfave/cli, mitchelh/cli and a few other packages help manage the complexity of command line tooling. Those tools are used by docker, coreos, hashicorp, etc.

Basically you want to drive consistency in how your command line works (which gets hard to manage if you don't build that stuff upfront).

@rargulati
Copy link
Contributor

@Shadowfiend both

@rargulati
Copy link
Contributor

rargulati commented Mar 13, 2018

@Shadowfiend I liked most of what you had, just a few spots where I thought it would be helpful to bring clarity or consistency. Ie. the first thing people experience by typing in keep --help should be compact and clear. More heroku, less docker and geth :)

@Shadowfiend
Copy link
Contributor Author

Got it. It wasn't immediately clear to me what the changes were between what you had and what's in the original description. Do you mind reworking the comment to focus on the differences? Then we can update the description based on agreement/disagreement (basically issue description becomes a sort of final-ish spec).

@Shadowfiend
Copy link
Contributor Author

Also of note… I went for the shape of --help docs, but I'm not necessarily saying that our help docs will look exactly like this. It's just a decent format to lay out what we want. My goal was to show all the possibilities, not prescribe exactly what running --help would look like. The output of --help will depend on how we implement the parsing for sure. Should have made that clearer, my apologies.

@rargulati
Copy link
Contributor

Ahhh gotcha. That makes more sense and is a relief.

@Shadowfiend
Copy link
Contributor Author

Basically, focus here is on interface (commands, flags, etc), not documentation.

@pschlump
Copy link
Contributor

I have used urfave/cli it is really solid - I have also coded up this kind of a CLI with just the standard library flag stuff.

@Shadowfiend Shadowfiend added the 💻 interface The user interface: command-line invocation, packaging, etc. label Apr 30, 2018
@Shadowfiend
Copy link
Contributor Author

Let's go with urfave/cli for this.

@Shadowfiend
Copy link
Contributor Author

Going to consider this “good and complete enough” as a discussion and spec-ish. We're making the final moves on the last of the high-level bits here via the ethereum subcommand (corresponding roughly to contract in the original description) via #883.

Closing!

dimpar pushed a commit that referenced this issue Feb 10, 2023
Fix dump of MerkleInputTbtcv2Rewards JSON
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💻 interface The user interface: command-line invocation, packaging, etc.
Projects
None yet
Development

No branches or pull requests

3 participants