makitso
Advanced tools
Comparing version 1.1.1 to 1.2.0
@@ -9,2 +9,3 @@ "use strict"; | ||
const Autocomplete = require("./keypress-autocomplete"); | ||
const AutoHelp = require("./keypress-autohelp"); | ||
const CommandInfo = require("./keypress-command-info"); | ||
@@ -34,3 +35,3 @@ const Validate = require("./keypress-validate"); | ||
debug({ appCmd, cmdArgs, input }); | ||
await appCmd.action({ context, input }); | ||
await appCmd.action({ context, command: appCmd, input }); | ||
} | ||
@@ -56,2 +57,6 @@ return promptAndRun(arg0); | ||
const keyPressAutoHelp = { | ||
keyPress: AutoHelp({ commandInfo }) | ||
}; | ||
const keyPressValidate = { | ||
@@ -67,2 +72,3 @@ keyPress: Validate() | ||
keyPressAutocomplete, | ||
keyPressAutoHelp, | ||
keyPressValidate | ||
@@ -69,0 +75,0 @@ ] |
@@ -49,4 +49,4 @@ const _every = require("lodash/every"); | ||
state.footer = info.suggests.join(" "); | ||
} else if (info.description) { | ||
state.footer = info.description; | ||
} else { | ||
state.footer = null; | ||
} | ||
@@ -53,0 +53,0 @@ } |
@@ -25,2 +25,3 @@ const _filter = require("lodash/filter"); | ||
info.suggests = getSuggests(appCmd.commands || appCmd); | ||
info.help = null; | ||
if (!appCmd.commands) { | ||
@@ -37,2 +38,3 @@ info.input = parse({ appCmd, cmdArgs, cmdLine }); | ||
context, | ||
command: appCmd, | ||
input: info.input | ||
@@ -45,2 +47,18 @@ }); | ||
} | ||
if (!appCmd.help) { | ||
info.helps = []; | ||
} else { | ||
debug({ helpsFn: typeof appCmd.help }); | ||
if (typeof appCmd.help === "function") { | ||
debug(["appCmd.help", appCmd.help.toString()]); | ||
info.help = await appCmd.help({ | ||
context, | ||
command: appCmd, | ||
input: info.input | ||
}); | ||
debug(["command.helps", info.help]); | ||
} else { | ||
info.help = appCmd.help; | ||
} | ||
} | ||
} | ||
@@ -47,0 +65,0 @@ } else { |
{ | ||
"name": "makitso", | ||
"version": "1.1.1", | ||
"version": "1.2.0", | ||
"description": "A Framework for building composable interactive commandline apps", | ||
@@ -21,5 +21,5 @@ "main": "index.js", | ||
"keytar": "^4.0.5", | ||
"makitso-prompt": "^2.0.1", | ||
"makitso-prompt": "^2.0.2", | ||
"prettyjson": "^1.2.1", | ||
"yargs-parser": "^8.0.0" | ||
"yargs-parser": "^9.0.2" | ||
}, | ||
@@ -29,9 +29,9 @@ "devDependencies": { | ||
"eslint-config-prettier": "^2.6.0", | ||
"eslint-config-standard": "^10.2.1", | ||
"eslint-config-standard": "^11.0.0", | ||
"eslint-plugin-import": "^2.8.0", | ||
"eslint-plugin-node": "^5.2.0", | ||
"eslint-plugin-node": "^6.0.0", | ||
"eslint-plugin-prettier": "^2.3.1", | ||
"eslint-plugin-promise": "^3.6.0", | ||
"eslint-plugin-standard": "^3.0.1", | ||
"jest": "^21.2.1", | ||
"jest": "^22.4.0", | ||
"prettier": "^1.7.4" | ||
@@ -38,0 +38,0 @@ }, |
Sorry, the diff of this file is not supported yet
183836
42
2211
+ Addedyargs-parser@9.0.2(transitive)
- Removedyargs-parser@8.1.0(transitive)
Updatedmakitso-prompt@^2.0.2
Updatedyargs-parser@^9.0.2