Skip to content

feat: adding an easter egg for the tool. #451

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 18, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions addon/ng2/commands/easter-egg.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import * as Command from 'ember-cli/lib/models/command';
import * as Promise from 'ember-cli/lib/ext/promise';
import * as chalk from 'chalk';


function pickOne(of: string[]): string {
return of[Math.floor(Math.random() * of.length)];
}


module.exports = function(name) {
return Command.extend({
name: name,
works: 'insideProject',

run: function (commandOptions, rawArgs): Promise<void> {
var stringUtils = require('ember-cli/lib/utilities/string');
this[stringUtils.camelize(this.name)](commandOptions, rawArgs);

return Promise.resolve();
},

makeThisAwesome: function() {
const phrase = pickOne([
`You're on it, there's nothing for me to do!`,
`Let's take a look... nope, it's all good!`,
`You're doing fine.`,
`You're already doing great.`,
`Nothing to do; already awesome. Exiting.`,
`Error 418: As Awesome As Can Get.`
]);
console.log(chalk.green(phrase));
}
});
};
5 changes: 4 additions & 1 deletion addon/ng2/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ module.exports = {
'doc': require('./commands/doc'),
'github-pages-deploy': require('./commands/github-pages-deploy'),

// Configuration
// Easter eggs.
'make-this-awesome': require('./commands/easter-egg')('make-this-awesome'),

// Configuration.
'set': require('./commands/set'),
'get': require('./commands/get')
};
Expand Down