Skip to content

Commit

Permalink
feat: introduce deinit hook
Browse files Browse the repository at this point in the history
  • Loading branch information
Oscaner committed Dec 14, 2024
1 parent 9ed5f72 commit d6918df
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,15 @@ export async function run(argv?: string[], options?: Interfaces.LoadOptions): Pr
// display version if applicable
if (versionAddition(argv, config)) {
ux.stdout(config.userAgent)
await config.runHook('deinit', {argv: argvSlice, id})
await collectPerf()
return
}

// display help version if applicable
if (helpAddition(argv, config)) {
await showHelp(argv)
await config.runHook('deinit', {argv: argvSlice, id})
await collectPerf()
return
}
Expand All @@ -90,6 +92,7 @@ export async function run(argv?: string[], options?: Interfaces.LoadOptions): Pr
const topic = config.flexibleTaxonomy ? null : config.findTopic(id)
if (topic) {
await showHelp([id])
await config.runHook('deinit', {argv: argvSlice, id})
await collectPerf()
return
}
Expand All @@ -100,6 +103,7 @@ export async function run(argv?: string[], options?: Interfaces.LoadOptions): Pr
try {
return await config.runCommand(id, argvSlice, cmd)
} finally {
await config.runHook('deinit', {argv: argvSlice, id})
await collectPerf()
}
}

0 comments on commit d6918df

Please sign in to comment.