Skip to content

Commit

Permalink
Display tarec version in help
Browse files Browse the repository at this point in the history
  • Loading branch information
geowarin committed May 11, 2016
1 parent 4f71a9e commit 33c8587
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion lib/bin/showHelp.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

const chalk = require('chalk');

module.exports = function showHelp (commands) {
module.exports = function showHelp (commands, tarecPkg) {

const version = tarecPkg.version;
console.log(`Tarec ${chalk.blue(version)}`);
console.log("\nAvailable commands:");
const availableCommands = commands.commands;
Object.keys(availableCommands).forEach(commandName => {
Expand Down
5 changes: 3 additions & 2 deletions lib/bin/tarec.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ if (!fs.existsSync(indexPath)) {
indexPath = path.join(rootDir, 'lib/templates/index.ejs');
}

const tarecPkg = require(path.join(rootDir, 'package.json'))
const pkg = loadPackageJson(projectDir);

const context = {
Expand All @@ -40,7 +41,7 @@ addConfiguredPlugins(context, commands);

const args = process.argv.slice(2);
if (args.length === 0 || args[0] == '-h' || args[0] == '--help') {
showHelp(commands);
showHelp(commands, tarecPkg);
process.exit(0);
}
const commandName = args[0];
Expand All @@ -56,6 +57,6 @@ try {
} catch (e) {
console.error(chalk.red(e.message));
console.error(e.stack);
showHelp(commands);
showHelp(commands, tarecPkg);
process.exit(1);
}

0 comments on commit 33c8587

Please sign in to comment.