Skip to content

fix: don't treat an empty command name as an input target - #640

Open
NgoQuocViet2001 wants to merge 1 commit into
open-cli-tools:mainfrom
NgoQuocViet2001:fix-input-empty-name
Open

NgoQuocViet2001 wants to merge 1 commit into
open-cli-tools:mainfrom
NgoQuocViet2001:fix-input-empty-name

Conversation

@NgoQuocViet2001

Copy link
Copy Markdown

With --handle-input, commands without a name were still registered as input targets under the empty string. Any input line starting with : therefore matched the empty prefix. It went to the last unnamed command with its leading colon stripped, instead of going unchanged to the default target. This has been the behaviour for a long time. It affects the default case (no --names), a single unnamed command, and partial --names lists where some commands get no name.

Before: concurrently -i "iex -S mix phx.server" "npm run watch", then type :observer.start(). npm run watch receives observer.start() and iex receives nothing.
After: iex receives :observer.start().

This change registers a command under its name only when it has one, in line with docs/cli/input-handling.md ("If the command has a name"). Targeting by index or by a real name works as before.

  • Ran: pnpm test with the new input-handler case. It fails on main and passes with this change. The rest of the suite passes, except the "is of success when a SIGINT is sent" test in bin/index.spec.ts, which also fails on main on Windows.
  • Checked: pnpm run lint and pnpm run typecheck are clean.

@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 98.722% (+0.003%) from 98.719% — NgoQuocViet2001:fix-input-empty-name into open-cli-tools:main

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants