diff --git a/NOTICE.txt b/NOTICE.txt index 826a5db6..7519db8c 100644 --- a/NOTICE.txt +++ b/NOTICE.txt @@ -64,7 +64,7 @@ released to the public npm registry; depend on it through the workspace. ------------------------------------------------------------------------ -@elastic/es-schemas@1.0.1 +@elastic/es-schemas@1.0.2 License: UNLICENSED Repository: https://github.com/elastic/cli Publisher: Elastic Client Library Maintainers @@ -1133,7 +1133,7 @@ THIS SOFTWARE. ------------------------------------------------------------------------ -yaml@2.9.0 +yaml@2.8.4 License: ISC Repository: https://github.com/eemeli/yaml Publisher: Eemeli Aro diff --git a/src/cli.ts b/src/cli.ts index 2468fede..45fb2882 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -184,13 +184,14 @@ if (firstArg === 'status') { const SKIP_EARLY_CONFIG = new Set([ 'version', 'extension', 'status', ...COMPLETION_COMMAND_NAMES, ...skipConfigNames, ]) +let earlyConfig: Awaited> | undefined if (firstArg == null || !SKIP_EARLY_CONFIG.has(firstArg)) { // Parse --profile early (before Commander's full parse) so the early config load // and hideBlockedCommands can apply the correct profile-based allow-list to --help. const profileArgIdx = process.argv.indexOf('--command-profile') const earlyProfile = profileArgIdx !== -1 ? process.argv[profileArgIdx + 1] as BuiltInProfile | undefined : undefined - const earlyConfig = await loadConfig({ + earlyConfig = await loadConfig({ ...(earlyProfile != null && { profileName: earlyProfile }), }) if (earlyConfig.ok) { @@ -199,11 +200,13 @@ if (firstArg == null || !SKIP_EARLY_CONFIG.has(firstArg)) { } } +// Render the banner before --help output too, not just for bare `elastic` (#390). +program.addHelpText('before', () => + process.argv.includes('--json') || (earlyConfig?.ok === true && earlyConfig.value.banner === false) + ? '' : renderLogo(VERSION).replace(/\n$/, '') +) + if (process.argv.slice(2).length === 0) { - const earlyConfig = await loadConfig() - if (!earlyConfig?.ok || earlyConfig.value.banner !== false) { - process.stdout.write(renderLogo(VERSION)) - } program.outputHelp() process.exit(0) }