Skip to content

Commit 589e276

Browse files
committed
fix(cli): fix completion and make-this-awesome command invalid problem(#1889)
1 parent cacaa4e commit 589e276

File tree

3 files changed

+41
-42
lines changed

3 files changed

+41
-42
lines changed

addon/ng2/commands/completion.js

-18
This file was deleted.

addon/ng2/commands/completion.ts

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

addon/ng2/commands/easter-egg.ts

+24-24
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,27 @@ function pickOne(of: string[]): string {
88
}
99

1010

11-
export default function(name: string) {
12-
return Command.extend({
13-
name: name,
14-
works: 'insideProject',
15-
16-
run: function (commandOptions: any, rawArgs: string[]): Promise<void> {
17-
(this as any)[stringUtils.camelize(this.name)](commandOptions, rawArgs);
18-
19-
return Promise.resolve();
20-
},
21-
22-
makeThisAwesome: function() {
23-
const phrase = pickOne([
24-
`You're on it, there's nothing for me to do!`,
25-
`Let's take a look... nope, it's all good!`,
26-
`You're doing fine.`,
27-
`You're already doing great.`,
28-
`Nothing to do; already awesome. Exiting.`,
29-
`Error 418: As Awesome As Can Get.`
30-
]);
31-
console.log(chalk.green(phrase));
32-
}
33-
});
34-
};
11+
const MakeThisAwesomeCommand = Command.extend({
12+
name: 'make-this-awesome',
13+
works: 'insideProject',
14+
15+
run: function (commandOptions: any, rawArgs: string[]): Promise<void> {
16+
(this as any)[stringUtils.camelize(this.name)](commandOptions, rawArgs);
17+
18+
return Promise.resolve();
19+
},
20+
21+
makeThisAwesome: function() {
22+
const phrase = pickOne([
23+
`You're on it, there's nothing for me to do!`,
24+
`Let's take a look... nope, it's all good!`,
25+
`You're doing fine.`,
26+
`You're already doing great.`,
27+
`Nothing to do; already awesome. Exiting.`,
28+
`Error 418: As Awesome As Can Get.`
29+
]);
30+
console.log(chalk.green(phrase));
31+
}
32+
});
33+
34+
export default MakeThisAwesomeCommand;

0 commit comments

Comments
 (0)