Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 <eemeli@gmail.com>
Expand Down
13 changes: 8 additions & 5 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,13 +184,14 @@ if (firstArg === 'status') {
const SKIP_EARLY_CONFIG = new Set<string>([
'version', 'extension', 'status', ...COMPLETION_COMMAND_NAMES, ...skipConfigNames,
])
let earlyConfig: Awaited<ReturnType<typeof loadConfig>> | 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) {
Expand All @@ -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)
}
Expand Down
Loading