Skip to content

Commit

Permalink
FIX verison flag issue
Browse files Browse the repository at this point in the history
  • Loading branch information
mustafashykh committed Jun 3, 2021
1 parent f19f972 commit 91c083b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ps-cli/express",
"version": "2.1.2",
"version": "2.1.3",
"description": "Express Boilerplate Boilerplate based upto express-generator",
"main": "src/index.js",
"scripts": {
Expand Down
24 changes: 13 additions & 11 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const { Command } = require('commander');
const data = require('./utils/data');
const packJson = require('../package.json');
const jsWorkflows = require('./workflows/js');
const chalk = require('chalk');
const program = new Command();

/**
Expand All @@ -13,12 +14,15 @@ const program = new Command();
program.name('@ps-cli/express');

// Global Options
program.option('-v, --version', `${packJson.version}`);
program
.option('-v, --version', `${packJson.version}`)
.description('Gives the verison of CLI')
.action(() => {
console.log(`${chalk.yellow(`version`)}: ${packJson.version}`);
process.exit(0);
})


// Help
program.helpOption('-h, --help', 'Get the help info');
program.addHelpText('before', `\n`);
program.addHelpText('after', data.helpInfo);
// Commads
program
.command(`new <name>`)
Expand All @@ -32,13 +36,11 @@ const program = new Command();
await jsWorkflows.new(name, options);
})


// Loading all Agrs
// Help
program.helpOption('-h, --help', 'Get the help info');
program.addHelpText('before', `\n`);
program.addHelpText('after', data.helpInfo);
program.parse();
if (program.opts().version) {
console.log(packJson.version);
process.exit(0);
}

})();

Expand Down

0 comments on commit 91c083b

Please sign in to comment.