Skip to content

Commit 926a8e9

Browse files
filipesilvaJonathan Jayet
authored and
Jonathan Jayet
committed
chore(help): add completion to help (angular#2483)
1 parent 4c28865 commit 926a8e9

File tree

3 files changed

+21
-23
lines changed

3 files changed

+21
-23
lines changed

packages/angular-cli/commands/completion.js

-18
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import * as path from 'path';
2+
import * as fs from 'fs';
3+
4+
const Command = require('ember-cli/lib/models/command');
5+
6+
const CompletionCommand = Command.extend({
7+
name: 'completion',
8+
description: 'Adds autocomplete functionality to `ng` commands and subcommands',
9+
works: 'everywhere',
10+
run: function() {
11+
const scriptPath = path.resolve(__dirname, '..', 'utilities', 'completion.sh');
12+
const scriptOutput = fs.readFileSync(scriptPath, 'utf8');
13+
14+
console.log(scriptOutput);
15+
}
16+
});
17+
18+
export default CompletionCommand;

packages/angular-cli/commands/help.ts

+3-5
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@ const stringUtils = require('ember-cli-string-utils');
66
const lookupCommand = require('ember-cli/lib/cli/lookup-command');
77

88
const commandsToIgnore = [
9-
'help',
109
'easter-egg',
11-
'completion',
12-
'github-pages-deploy'
10+
'github-pages-deploy' // errors because there is no base github-pages command
1311
];
1412

1513
const HelpCommand = Command.extend({
@@ -21,8 +19,8 @@ const HelpCommand = Command.extend({
2119

2220
run: function (commandOptions: any) {
2321
let commandFiles = fs.readdirSync(__dirname)
24-
// Remove files that are not JavaScript
25-
.filter(file => file.match(/\.js$/))
22+
// Remove files that are not JavaScript or Typescript
23+
.filter(file => file.match(/\.(j|t)s$/) && !file.match(/\.d.ts$/))
2624
.map(file => path.parse(file).name)
2725
.map(file => file.toLowerCase());
2826

0 commit comments

Comments
 (0)