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

add -r should suggest next steps #6647

Open
autonome opened this issue Sep 16, 2019 · 4 comments
Open

add -r should suggest next steps #6647

autonome opened this issue Sep 16, 2019 · 4 comments
Labels
topic/docs-ipfs Topic docs-ipfs

Comments

@autonome
Copy link

autonome commented Sep 16, 2019

We should add a short message that suggests what's possible, or eases next steps to view the added data, eg:

"Recursive add complete! You can preview on the public gateway at https://..."

Location

ipfs add -r .

Description

From https://macwright.org/2019/06/08/ipfs-again.html:

Screen Shot 2019-09-16 at 4 06 20 PM

@autonome autonome added the topic/docs-ipfs Topic docs-ipfs label Sep 16, 2019
@Stebalien
Copy link
Member

As he admits, this is simply how CLI tools work. Instead of trying to make the go-ipfs CLI something it isn't, we should:

  1. Recommend ipfs-desktop.
  2. Show users how to add files via ipfs desktop.

We should still offer the CLI tool as an option but CLI users generally don't expect fancy messages.

@autonome
Copy link
Author

What is the downside to a short helpful message? How would that minor string addition turn go-ipfs into something it is not?

Why are we limiting the options to an abstract common denominator of "cli tools", which historically are considered terribly unhelpful except to the most proficient users?

@Stebalien
Copy link
Member

My two concerns are:

  1. Not annoying the user.
  2. Keeping the output parsable.

Having a nice and friendly "you did a thing!" message is useful for (some) new users running the command for the first time but is really annoying for everyone else running the command for the hundredth time. These commands are meant to be run over and over so they're optimized for that use-case.

Also note, as with most unix commands, the output of ipfs add -r is designed to be parsed. We have to be careful about changing the output:

ipfs add -r foobar | while read event cid path; do
  # do something...
done

On the other hand, commands like ipfs daemon and ipfs add do spit out a bunch of helpful information because these commands (a) are meant to be run infrequently and (b) aren't generally meant to be have their output parsed.


Given these constraints, we can implement this as follows:

  1. Only spit out the message the first time, recording which commands have been run in some dot file. Sudo has a feature like this (called "lecture").
  2. Have a config option for disabling these help messages.
  3. Send the message to STDERR instead of STDOUT so we don't break users trying to parse output. This is how commands like curl deal with status messages.
  4. Skip all this logic if the command isn't being run interactively. On Linux, this can be detected by checking for a TTY.

In this case, the help message would be:

added QmFoo myDir

  Congratulations! You've added your first file to IPFS.... { dynamic help text that may need to tell the user to start the daemon, etc. }

@hsanjuan
Copy link
Contributor

My take here is that given that we can build nice UIs on top of IPFS (desktop), we should avoid bloating the CLIs to make them user-friendly for people that are not used to work with CLI interfaces. However, that should not be a excuse for not having awesome CLI documentation. In this case ipfs add --help is pretty good and detailed imho.

Note that CLIs are effecitvely APIs (more so in go-ipfs since it matches 1to1 with the HTTP API). I disagree that CLIs are historically unhelpful. They are the best for what they do: an interoperable text interface (not only to humans but to other programs).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic/docs-ipfs Topic docs-ipfs
Projects
None yet
Development

No branches or pull requests

3 participants