From 8fbbb872aa64507222fac964dc1baab7c3cea7a1 Mon Sep 17 00:00:00 2001 From: Jb Landry Date: Thu, 4 May 2017 13:35:21 -0400 Subject: [PATCH] Support task namespace --- index.js | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 8de0d88..ae0f046 100644 --- a/index.js +++ b/index.js @@ -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; @@ -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(); } diff --git a/package.json b/package.json index 91a9ff0..f532a54 100644 --- a/package.json +++ b/package.json @@ -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",