From f4b956ea6c39512b9284463c48de704e3fdf5f48 Mon Sep 17 00:00:00 2001 From: Muhammad Aaqil Date: Sun, 1 Dec 2024 19:38:20 +0500 Subject: [PATCH] feat: support extending lb4 cli Signed-off-by: Muhammad Aaqil --- packages/cli/lib/cli.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/cli/lib/cli.js b/packages/cli/lib/cli.js index bece69245672..15e31500e78c 100644 --- a/packages/cli/lib/cli.js +++ b/packages/cli/lib/cli.js @@ -14,6 +14,7 @@ const PREFIX = 'loopback4:'; const {printVersions} = require('./version-helper'); const {tabCompletionCommands} = require('./tab-completion'); +const extendedGenerators = ['fuzzy']; /** * Parse arguments and run corresponding command @@ -22,6 +23,13 @@ const {tabCompletionCommands} = require('./tab-completion'); * @param log - Log function */ function runCommand(env, opts, log) { + // register any extended generator + extendedGenerators.forEach(extendedGenerator => { + env.register( + require.resolve(`./${extendedGenerator}`), + `${PREFIX}:${extendedGenerator}`, + ); + }); const dryRun = opts.dryRun || opts['dry-run']; const args = opts._; const originalCommand = args.shift();