Do you want to request a feature or report a bug?
_Feature_
What is the current behavior?
$ yarn list
yarn list v0.16.1
error Did you mean `yarn ls`?
$ yarn rm somepkg
yarn rm v0.16.1
error Did you mean `yarn remove`?
If the current behavior is a bug, please provide the steps to reproduce.
Not a bug _per se_, but it feels schizo to ask users to use the unix verb in one instance and the human verb in the next.
What is the expected behavior?
Consistency, or better yet, flexibility! 👍
Please mention your node.js, yarn and operating system version.
node 6.9.1 / yarn 0.16.1 / macOS 10.12.1
<3
I looked into fixing this, but it appears that aliases are intentionally used as recommendations and not meant to actually execute?
from src/cli/index.js#L122-L130
if (commandName && typeof aliases[commandName] === 'string') {
const alias = aliases[commandName];
command = {
run(config: Config, reporter: ConsoleReporter | JSONReporter): Promise<void> {
throw new MessageError(`Did you mean \`yarn ${alias}\`?`);
},
};
}
Upon further digging through the history, it was changed to an error in commit https://github.com/yarnpkg/yarn/pull/439/commits/ef0f9f1667db33f0a77701dab635445925145555 which is part of this PR https://github.com/yarnpkg/yarn/pull/439. I'm not sure the reasoning for the changes, but I imagine it wasn't changed by accident. Perhaps @kittens has more insight?
Hope this helps some 😄
We don't want aliases since it's confusing to have multiple commands that do the same thing. We can either:
ls
to list
.remove
to rm
.Since all of the other cli commands look to be complete words, changing ls
to list
makes the most sense to me. If that sounds good I can make a PR with the changes.
That sounds reasonable to me, Michael.
I’m not sure I understand how aliases are confusing, Sebastian, but I am open to that possibly being true. I imagine a well-designed "yarn help" would designate common aliases as such, though.
Would really like to see this. TBH I don't agree that it's confusing, I'd venture to say most developers working with yarn are familiar with the concept of aliases. Seems like the usability equivalent of a microoptimization to me,
I use npm i
over npm install
all the time, Googling for what does npm i mean
yields nothing that implies that it has caused confusion.
It's kind of annoying to type rm out of habit only to be kicked out and have to type it again.
I would prefer something like git alias
option over providing a lot of built in aliases.
And, currently I have a alias y=yarn
in my env. So, for me y add
is ok. And, if I wish I can go ham like alias ya="yarn add"
alias yr="yarn remove"
PR: https://github.com/yarnpkg/yarn/pull/1940
Renamed ls to list, updated the aliases files so ls points to list.
What about the subcommand options? All of them are ls
or rm
unless you're doing global
then it's list
and remove
, is that ok?
Inconsistency is now through the roof after #1940 merged in v0.18 release:
$ yarn ls
yarn ls v0.18.0
error Did you mean `yarn list`?
$ yarn global list
yarn global v0.18.0
error Invalid subcommand. Try "add, bin, ls, remove, upgrade"
$ yarn config ls
yarn config v0.18.0
error Invalid subcommand. Try "set, get, delete, list"
$ yarn cache list
yarn cache v0.18.0
error Invalid subcommand. Try "ls, dir, clean"
Aside from the inconsistency, isn't renaming commands a "breaking" API change?
We have dev scripts on some projects that rely on yarn commands that we now have to change, even though 0.17.0
to 0.18.0
is a _minor_ change.
Also not that my opinion matters, but I don't see the issue with having multiple commands do the same thing. It's a very common behaviour across all CLI tools after all.
Even throwing a warning and just running the command anyway would be more helpful than just saying "did you mean X?"
@iest in semver prior to 1.0, a minor version bump is for breaking changes - ie, 0.17 to 0.18 is indeed a breaking change.
Fair enough, ignore me.
~
❯ yarn ls
yarn ls v0.19.1
error Did you mean yarn list
?
info Visit https://yarnpkg.com/en/docs/cli/list for documentation about this command.
~
-> Page Not Found
I'd personally prefer matching with Unix commands: ls
, rm
. For consistency across tooling.
Adding aliases would be nice. It's also shorter, less chars to type.
I know you can always alias on your bash profile, I usually do. But there are servers and containers too.
node -v
v6.6.0
yarn ls v0.23.2
error Did you mean yarn list
?
info Visit https://yarnpkg.com/en/docs/cli/list for documentation about this command.
@bestander close
The consensus seems to be that we're removing aliases from Yarn.
Most helpful comment
I'd personally prefer matching with Unix commands:
ls
,rm
. For consistency across tooling.Adding aliases would be nice. It's also shorter, less chars to type.
I know you can always alias on your bash profile, I usually do. But there are servers and containers too.