Comparing version 0.8.0 to 0.9.0
{ | ||
"name": "gluegun", | ||
"version": "0.8.0", | ||
"version": "0.9.0", | ||
"description": "Build yourself a pluggable CLI.", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -57,6 +57,9 @@ const print = require('../utils/print') | ||
reject(isHidden), | ||
map(command => [ | ||
command.name, | ||
replace('$BRAND', context.runtime.brand, command.description || '-') | ||
]) | ||
map(command => { | ||
const alias = command.alias ? `(${command.alias})` : '' | ||
return [ | ||
`${command.name} ${alias}`, | ||
replace('$BRAND', context.runtime.brand, command.description || '-') | ||
] | ||
}) | ||
)(plugin) | ||
@@ -63,0 +66,0 @@ } |
@@ -51,2 +51,4 @@ const autobind = require('autobind-decorator') | ||
runtime.commandDescriptionToken = this.commandDescriptionToken | ||
runtime.commandHiddenToken = this.commandHiddenToken | ||
runtime.commandAliasToken = this.commandAliasToken | ||
runtime.extensionNameToken = this.extensionNameToken | ||
@@ -152,2 +154,8 @@ | ||
break | ||
case 'commandHidden': | ||
this.commandHiddenToken = value | ||
break | ||
case 'commandAlias': | ||
this.commandAliasToken = value | ||
break | ||
case 'extensionName': | ||
@@ -154,0 +162,0 @@ this.extensionNameToken = value |
@@ -207,3 +207,3 @@ const parseCommandLine = require('../cli/parse-command-line') | ||
load (directory, options = {}) { | ||
const { brand, extensionNameToken, commandNameToken, commandDescriptionToken } = this | ||
const { brand, extensionNameToken, commandNameToken, commandDescriptionToken, commandHiddenToken, commandAliasToken } = this | ||
@@ -213,2 +213,4 @@ const plugin = loadPluginFromDirectory(directory, { | ||
commandNameToken, | ||
commandHiddenToken, | ||
commandAliasToken, | ||
commandDescriptionToken, | ||
@@ -295,3 +297,3 @@ brand, | ||
return find( | ||
(command) => startsWith(command.name, rawCommand) | ||
(command) => startsWith(command.name, rawCommand) || rawCommand === command.alias | ||
, plugin.commands | ||
@@ -298,0 +300,0 @@ ) |
@@ -40,2 +40,4 @@ const { isNotFile } = require('../utils/filesystem-utils') | ||
const commandDescriptionToken = options.commandDescriptionToken || 'gluegunCommandDescription' | ||
const commandHiddenToken = options.commandHiddenToken || 'gluegunCommandHidden' | ||
const commandAliasToken = options.commandAliasToken || 'gluegunCommandAlias' | ||
@@ -65,3 +67,3 @@ // sanity check the input | ||
// try reading in tokens embedded in the file | ||
const tokens = findTokens(jetpack.read(file) || '', [commandNameToken, commandDescriptionToken]) | ||
const tokens = findTokens(jetpack.read(file) || '', [commandNameToken, commandDescriptionToken, commandHiddenToken, commandAliasToken]) | ||
@@ -71,2 +73,4 @@ // let's override if we've found these tokens | ||
command.description = tokens[commandDescriptionToken] || command.description | ||
command.alias = tokens[commandAliasToken] || command.alias | ||
command.hidden = (tokens[commandHiddenToken] || command.hidden) === 'true' | ||
@@ -73,0 +77,0 @@ // require in the module -- best chance to bomb is here |
@@ -33,2 +33,4 @@ const jetpack = require('fs-jetpack') | ||
commandNameToken, | ||
commandHiddenToken, | ||
commandAliasToken, | ||
commandDescriptionToken, | ||
@@ -73,3 +75,3 @@ extensionNameToken, | ||
`${directory}/commands/${file}`, | ||
{ commandNameToken, commandDescriptionToken } | ||
{ commandNameToken, commandDescriptionToken, commandHiddenToken, commandAliasToken } | ||
), | ||
@@ -124,3 +126,5 @@ jetpackPlugin.cwd('commands').find({ matching: commandFilePattern, recursive: false }) | ||
// set the hidden bit | ||
plugin.commands = map(assoc('hidden', hidden), plugin.commands) | ||
if (hidden) { | ||
plugin.commands = map(assoc('hidden', true), plugin.commands) | ||
} | ||
@@ -127,0 +131,0 @@ return plugin |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
66273
2063