Skip to content

Commit a49b6c0

Browse files
authored
fix: Ensure global options can appear in any order (#113)
1 parent ef7db12 commit a49b6c0

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/cli.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ program.addCommand(versionCmd)
5151
// invoked. For all other invocations (including `elastic --help`), a lightweight stub
5252
// is registered so the group appears in help text without paying the cost of loading
5353
// and compiling all API schemas.
54-
const firstArg = process.argv[2]
54+
const { operands } = program.parseOptions(process.argv.slice(2))
55+
const firstArg = operands[0]
5556

5657
if (firstArg === 'es') {
5758
const { registerEsCommands } = await import('./es/register.ts')

0 commit comments

Comments
 (0)