@oclif/core
Advanced tools
Comparing version 4.1.1 to 4.2.0
@@ -36,2 +36,9 @@ import { Command } from '../command'; | ||
}; | ||
finally: { | ||
options: { | ||
argv: string[]; | ||
id: string; | ||
}; | ||
return: void; | ||
}; | ||
init: { | ||
@@ -110,2 +117,6 @@ options: { | ||
/** | ||
* Runs at the end of the CLI lifecycle - regardless of success or failure. | ||
*/ | ||
type Finally = Hook<'finally'>; | ||
/** | ||
* Runs when the CLI is initialized before a command is executed. | ||
@@ -112,0 +123,0 @@ */ |
@@ -40,9 +40,2 @@ "use strict"; | ||
const initMarker = performance_1.Performance.mark(performance_1.OCLIF_MARKER_OWNER, 'main.run#init'); | ||
const collectPerf = async () => { | ||
marker?.stop(); | ||
if (!initMarker?.stopped) | ||
initMarker?.stop(); | ||
await performance_1.Performance.collect(); | ||
performance_1.Performance.debug(); | ||
}; | ||
const showHelp = async (argv) => { | ||
@@ -70,2 +63,10 @@ const Help = await (0, help_1.loadHelpClass)(config); | ||
const [id, ...argvSlice] = (0, help_1.normalizeArgv)(config, argv); | ||
const runFinally = async () => { | ||
marker?.stop(); | ||
if (!initMarker?.stopped) | ||
initMarker?.stop(); | ||
await performance_1.Performance.collect(); | ||
performance_1.Performance.debug(); | ||
await config.runHook('finally', { argv: argvSlice, id }); | ||
}; | ||
// run init hook | ||
@@ -76,3 +77,3 @@ await config.runHook('init', { argv: argvSlice, id }); | ||
ux_1.ux.stdout(config.userAgent); | ||
await collectPerf(); | ||
await runFinally(); | ||
return; | ||
@@ -83,3 +84,3 @@ } | ||
await showHelp(argv); | ||
await collectPerf(); | ||
await runFinally(); | ||
return; | ||
@@ -93,3 +94,3 @@ } | ||
await showHelp([id]); | ||
await collectPerf(); | ||
await runFinally(); | ||
return; | ||
@@ -103,4 +104,4 @@ } | ||
finally { | ||
await collectPerf(); | ||
await runFinally(); | ||
} | ||
} |
{ | ||
"name": "@oclif/core", | ||
"description": "base library for oclif CLIs", | ||
"version": "4.1.1", | ||
"version": "4.2.0", | ||
"author": "Salesforce", | ||
@@ -6,0 +6,0 @@ "bugs": "https://github.com/oclif/core/issues", |
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
406311
10222