protofire / eth-cli

CLI swiss army knife for Ethereum developers
https://www.npmjs.com/package/eth-cli
MIT License
239 stars 40 forks source link

Improve output of help commands #94

Closed fvictorio closed 5 years ago

fvictorio commented 5 years ago

This issue will be a little underdefined, but I'd like to start a discussion around this. Is there a way to improve the output of the help commands? Can discoverability be improved? We are using the default help from oclif, and just adding the relevant data. Can we make a custom help function more suitable for this project?

gitcoinbot commented 5 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


This issue now has a funding of 100.0 DAI (100.0 USD @ $1.0/DAI) attached to it.

guilhermejcgois commented 5 years ago

Did u have considered to use https://github.com/oclif/plugin-help ? With a USAGE and DESCRIPTION session?

fvictorio commented 5 years ago

We are using that plugin, but just with what it gives you out of the box. It doesn't seem to have docs, so if there's some way to customize it further, I don't know it.

gitcoinbot commented 5 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Work has been started.

These users each claimed they can complete the work by 267 years, 2 months from now. Please review their action plans below:

1) uivlis has started work.

I will go through the docs to see all possible commands and then update the help command.

Learn more on the Gitcoin Issue Details page.

uivlis commented 5 years ago

Hi @fvictorio, just fired up eth-cli and here is the output for eth help:

A collection of CLI tools to help with ethereum learning and development.

VERSION
  eth-cli/1.3.0 win32-x64 node-v10.4.0

USAGE
  $ eth [COMMAND]

COMMANDS
  abi            Allows actions with abis.
  conf           Allows configuring eth-cli.
  contract       Allows actions with contracts.
  help           display help for eth
  method         Allows actions with methods.
  networks       Show information for each known network.
  randomAddress  Prints a random Ethereum checksum address with its Private Key.
  repl
  transaction    Allows actions with transactions.

Also, this is the output for, say, eth help abi:

Allows actions with abis.

USAGE
  $ eth abi

COMMANDS
  abi:list     Displays the list of known-abis
  abi:methods  Get the hash of each method in the given ABI.
  abi:show     Displays a known ABI (ERC20, ERC721)

And here, for eth help abi:show:

Displays a known ABI (ERC20, ERC721)

USAGE
  $ eth abi:show ABI

ARGUMENTS
  ABI  The contract name.

OPTIONS
  -h, --help  show CLI help

EXAMPLES
  eth abi:show ERC20
  eth abi:show ERC721

I'm not sure what is the degree of discoverability that you mentioned in your comment, but it seems pretty discoverable to me as it is now. How would you like the output to be improved? Maybe, with some EXAMPLE usages in the description?

fvictorio commented 5 years ago

Two things come to mind.

First, I'd like to have a better output when you just run eth. The most important thing to improve there IMO would be to be able to customize the list of commands, for example by grouping them in different sections. Maybe we could also have some examples there.

The second thing is that if you just do eth abi:show (instead of eth help abi:show) you get a message that, while somewhat helpful, is not very nice. I would like to also show the help there (but returning a non-zero code to signal that the command can't be used without arguments).

uivlis commented 5 years ago

Well, for your first thing in mind, I don't foresee a solution, unless you decide to use a modified version of oclif/plugin-help which is the plugin who decides how those help menus are structured.

For your second thing in mind, I did some nasty machinations in the code, probably some tests will fail since you can now call commands without parameters etc.

But, you can now run eth abi:show and this is the result:

Displays a known ABI (ERC20, ERC721)

USAGE
  $ eth abi:show [ABI]

ARGUMENTS
  ABI  The contract name.

OPTIONS
  -h, --help  show CLI help

EXAMPLES
  eth abi:show ERC20
  eth abi:show ERC721
gitcoinbot commented 5 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Work for 100.0 DAI (100.0 USD @ $1.0/DAI) has been submitted by:

  1. @uivlis

@datakarima please take a look at the submitted work:


gitcoinbot commented 5 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


The funding of 100.0 DAI (100.0 USD @ $1.0/DAI) attached to this issue has been approved & issued to @uivlis.