Skip to content

Commit 6d145c3

Browse files
sudoarslanbestander
authored andcommitted
Bugfix help command (#3706)
* removes unsupported aliases from help command * fixed lint warnings * fixed compatibility issues * with prettier
1 parent 3970081 commit 6d145c3

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/cli/commands/help.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import * as constants from '../../constants.js';
55
import type {Reporter} from '../../reporters/index.js';
66
import type Config from '../../config.js';
77
import {sortAlpha, hyphenate} from '../../util/misc.js';
8+
import unsupportedAliases from '../unsupported-aliases.js';
9+
import aliases from '../aliases';
810
const chalk = require('chalk');
911

1012
export function hasWrapper(flags: Object, args: Array<string>): boolean {
@@ -41,11 +43,18 @@ export function run(config: Config, reporter: Reporter, commander: Object, args:
4143
const getDocsLink = name => `${constants.YARN_DOCS}${name || ''}`;
4244
console.log(' Commands:\n');
4345
for (const name of Object.keys(commands).sort(sortAlpha)) {
44-
if (commands[name].useless) {
46+
if (
47+
commands[name].useless ||
48+
unsupportedAliases[name] ||
49+
Object.keys(aliases).map(key => aliases[key]).indexOf(name) > -1
50+
) {
4551
continue;
4652
}
47-
48-
console.log(` - ${hyphenate(name)}`);
53+
if (aliases[name]) {
54+
console.log(` - ${hyphenate(name)} / ${aliases[name]}`);
55+
} else {
56+
console.log(` - ${hyphenate(name)}`);
57+
}
4958
}
5059
console.log('\n Run `' + chalk.bold('yarn help COMMAND') + '` for more information on specific commands.');
5160
console.log(' Visit ' + chalk.bold(getDocsLink()) + ' to learn more about Yarn.\n');

0 commit comments

Comments
 (0)