whyrusleeping / gx

A package management tool
MIT License
1.88k stars 110 forks source link

gx import prompts [y/N] but defaults to yes #171

Open ghost opened 6 years ago

ghost commented 6 years ago

Summary gx import prompts the user with [y/N] (implying no is the default), but if you just press ENTER, it seems to default to yes behavior.

Steps to reproduce:

$ gx import QmSFihvoND3eDaAYRCeLgLPt62yCPgMZs1NSZmKFEtJQQw
update imports of github.com/libp2p/go-floodsub to the newly imported package? [y/N] 

Press ENTER without typing 'y' or 'n'. The capital N in the message implies that the tool will default to no. However, it seems to update the imports anyway because a second invocation of the same command says that the package was already imported:

$ gx import QmSFihvoND3eDaAYRCeLgLPt62yCPgMZs1NSZmKFEtJQQw
ERROR: package QmSFihvoND3eDaAYRCeLgLPt62yCPgMZs1NSZmKFEtJQQw already imported as go-libp2p-floodsub 

Not sure if this is a bug or if I'm simply misunderstanding the tool. If it is a bug, an easy fix would be to change [y/N to [Y/n].

Version

$ gx --version
gx version 0.12.1

Platform is Ubuntu Linux.

Stebalien commented 6 years ago

This is working correctly, the error message is just a bit confusing. Something like the following would be more explicit:

replace go imports of "github.com/libp2p/go-floodsub" with "gx/ipfs/QmSFihvoND3eDaAYRCeLgLPt62yCPgMZs1NSZmKFEtJQQw/go-floodsub"?

But that's a little wordy. Thoughts on a better message?