fix(cli): add explicit helpOption configuration for consistent help-flag ordering
Add explicit .helpOption('-h, --help') call to the Commander program configuration so the help option is explicitly defined rather than relying on Commander.js lazy initialization. Add corresponding test to pin the behavior.
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -20,3 +20,20 @@ describe("cli-program", () => {
|
||||
expect(installBlock?.[1]).toContain('.alias("setup")')
|
||||
})
|
||||
})
|
||||
|
||||
test("program configures explicit '-h, --help' help option for consistent help-flag ordering", async () => {
|
||||
// given
|
||||
const cliProgramSource = await readFile(
|
||||
path.resolve(import.meta.dir, "cli-program.ts"),
|
||||
"utf-8",
|
||||
)
|
||||
|
||||
// when
|
||||
const programBlock = cliProgramSource.match(
|
||||
/program\s*\n((?:\s*\.\w+\([^)]*\)\s*\n?)*)/,
|
||||
)
|
||||
|
||||
// then
|
||||
expect(programBlock).not.toBeNull()
|
||||
expect(programBlock?.[1]).toContain('.helpOption("-h, --help", "Display help for command")')
|
||||
})
|
||||
|
||||
@@ -20,6 +20,7 @@ program
|
||||
.name("oh-my-opencode")
|
||||
.description("The ultimate OpenCode plugin - multi-model orchestration, LSP tools, and more")
|
||||
.version(VERSION, "-v, --version", "Show version number")
|
||||
.helpOption("-h, --help", "Display help for command")
|
||||
.enablePositionalOptions()
|
||||
|
||||
program
|
||||
|
||||
Reference in New Issue
Block a user