@hyperone/cli-framework
Advanced tools
Comparing version 2.0.8 to 2.0.9
@@ -9,2 +9,3 @@ | ||
const escape = value => `${value}`.replace('{', '\\\{').replace('}', '\\\}'); | ||
class Command { | ||
@@ -56,3 +57,3 @@ constructor(options = {}) { | ||
} | ||
async getUsage() { | ||
async renderUsage() { | ||
const options = await this.getOptions(); | ||
@@ -74,2 +75,3 @@ const fullName = this.getFullName(); | ||
header: examples.length > 1 ? 'Examples' : 'Example', | ||
examples, | ||
content: examples.map(({ title, command }) => ` | ||
@@ -95,4 +97,18 @@ {bold ${title}} | ||
]); | ||
return commandLineUsage(content); | ||
return content; | ||
} | ||
async getUsage(...args) { | ||
const usage = await this.renderUsage(...args); | ||
return commandLineUsage(usage.map(x => { | ||
const override = {}; | ||
if (x.summary) { | ||
override.summary.replace('\[(.+?)\]\((.+?)\)', (match) => `${match[1]} (${match[2]})`); | ||
override.raw = true; | ||
} | ||
return { | ||
...x, | ||
...override, | ||
}; | ||
})); | ||
} | ||
async exec(argv, parentOpts = {}) { | ||
@@ -99,0 +115,0 @@ const options = await this.getOptions(); |
{ | ||
"name": "@hyperone/cli-framework", | ||
"version": "2.0.8", | ||
"version": "2.0.9", | ||
"description": "", | ||
@@ -20,3 +20,3 @@ "main": "index.js", | ||
}, | ||
"gitHead": "4cfaa43a86700d54c7ebb2e81474a8f8f32d1b63" | ||
"gitHead": "d5f0ac0bbe9626e5c7c63f60b5b81702ad89d6b3" | ||
} |
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
13372
390