microsoft/rushstack

[rush] tab-complete fails to complete project list after `--to`

harttle opened this issue · 1 comments

Summary

I'm following https://rushjs.io/pages/developer/tab_completion/#bash to use autocomplete in Bash, it works to autocomplete subcommand, but not for project names.

Repro steps

  1. On MacOS, configure bash as per https://rushjs.io/pages/developer/tab_completion/#bash
  2. Clone rushstack repo as per https://rushjs.io/pages/intro/get_started/
  3. cd into ./rushstack, run rush install and rush build, they'll be successful
  4. Type in bash: rush build --to , note the whitespace at the end of line, then type <Tab>

Actual Result:
image

Expected Result: The by rush part should list project names.

Insights

As I investigated, it calls this command to auto complete:

> rush tab-complete --position 16 --word "rush build --to "
--to
--to-except
--to-version-policy

Strangely if --position is 17 or even 15, it prints the list of projects, but not with 16.

Standard questions

Please answer these questions to help us investigate your issue more quickly:

Question Answer
@microsoft/rush globally installed version? 5.120.2
rushVersion from rush.json? 5.120.2
useWorkspaces from rush.json? undefined
Operating system? Mac
Would you consider contributing a PR? Maybe
Node.js version (node -v)? v18.15.0

Thanks for reporting. I identified the issue and put together a fix.