Skip to content
This repository has been archived by the owner on Feb 8, 2023. It is now read-only.

Commit

Permalink
Support task namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
jblandry committed May 4, 2017
1 parent 3c227c8 commit 8fbbb87
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,8 @@ module.exports = class Cli {

const tasks = [];

glob.sync(`${STATIC.tasks.path}/!(default).js`).forEach((task) => {
tasks.push(task.split(STATIC.tasks.path).slice(-1).pop().substring(1).slice(0, -3));
glob.sync(`${STATIC.tasks.path}/**/!(default).js`).forEach((task) => {
tasks.push(task.split(STATIC.tasks.path).slice(-1).pop().substring(1).slice(0, -3).replace(/\//g, ':'));
});

STATIC.tasks.list = tasks;
Expand All @@ -298,7 +298,7 @@ module.exports = class Cli {

if (task) {
if (STATIC.tasks.list.includes(task)) {
require(`${STATIC.tasks.path}/${task}`)(meowCli); // eslint-disable-line global-require
require(`${STATIC.tasks.path}/${task.replace(/:/g, '/')}`)(meowCli); // eslint-disable-line global-require
} else {
meowCli.showHelp();
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@absolunet/cli",
"version": "0.2.1",
"version": "0.3.0",
"description": "CLI utilities",
"definition": "",
"homepage": "https://github.com/absolunet/node-cli",
Expand Down

0 comments on commit 8fbbb87

Please sign in to comment.