@oclif/core 4.7.2 → 4.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/help/command.js +15 -2
- package/package.json +1 -1
package/lib/help/command.js
CHANGED
|
@@ -171,9 +171,22 @@ class CommandHelp extends formatter_1.HelpFormatter {
|
|
|
171
171
|
if (noChar)
|
|
172
172
|
left = left.replace(' ', '');
|
|
173
173
|
let right = flag.summary || flag.description || '';
|
|
174
|
+
// Build metadata string (default, env, or both)
|
|
175
|
+
const metadata = [];
|
|
174
176
|
const canBeCached = !(this.opts.respectNoCacheDefault === true && flag.noCacheDefault === true);
|
|
175
|
-
if (flag.type === 'option'
|
|
176
|
-
|
|
177
|
+
if (flag.type === 'option') {
|
|
178
|
+
if (flag.default && canBeCached) {
|
|
179
|
+
metadata.push(`default: ${flag.default}`);
|
|
180
|
+
}
|
|
181
|
+
if (flag.env) {
|
|
182
|
+
metadata.push(`env: ${flag.env}`);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
else if (flag.type === 'boolean' && flag.env) {
|
|
186
|
+
metadata.push(`env: ${flag.env}`);
|
|
187
|
+
}
|
|
188
|
+
if (metadata.length > 0) {
|
|
189
|
+
right = `${(0, theme_1.colorize)(this.config?.theme?.flagDefaultValue, `[${metadata.join(', ')}]`)} ${right}`;
|
|
177
190
|
}
|
|
178
191
|
if (flag.required)
|
|
179
192
|
right = `${(0, theme_1.colorize)(this.config?.theme?.flagRequired, '(required)')} ${right}`;
|