Skip to content

Commit 193d1bf

Browse files
committed
feat: adding an easter egg for the tool.
1 parent 0b69491 commit 193d1bf

File tree

2 files changed

+39
-1
lines changed

2 files changed

+39
-1
lines changed

addon/ng2/commands/easter-egg.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import * as Command from 'ember-cli/lib/models/command';
2+
import * as Promise from 'ember-cli/lib/ext/promise';
3+
import * as chalk from 'chalk';
4+
5+
6+
function pickOne(of: string[]): string {
7+
return of[Math.floor(Math.random() * of.length)];
8+
}
9+
10+
11+
module.exports = function(name) {
12+
return Command.extend({
13+
name: name,
14+
works: 'insideProject',
15+
16+
run: function (commandOptions, rawArgs): Promise<void> {
17+
var stringUtils = require('ember-cli/lib/utilities/string');
18+
this[stringUtils.camelize(this.name)](commandOptions, rawArgs);
19+
20+
return Promise.resolve();
21+
},
22+
23+
makeThisAwesome: function() {
24+
const phrase = pickOne([
25+
`You're on it, there's nothing for me to do!`,
26+
`Let's take a look... nope, it's all good!`,
27+
`You're doing fine.`,
28+
`You're already doing great.`,
29+
`Nothing to do; already awesome. Exiting.`,
30+
`Error 418: As Awesome As Can Get.`
31+
]);
32+
console.log(chalk.green(phrase));
33+
}
34+
});
35+
};

addon/ng2/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ module.exports = {
1717
'doc': require('./commands/doc'),
1818
'github-pages-deploy': require('./commands/github-pages-deploy'),
1919

20-
// Configuration
20+
// Easter eggs.
21+
'make-this-awesome': require('./commands/easter-egg')('make-this-awesome'),
22+
23+
// Configuration.
2124
'set': require('./commands/set'),
2225
'get': require('./commands/get')
2326
};

0 commit comments

Comments
 (0)