platformsh / legacy-cli

This is the legacy version of Platform.sh's command-line interface. The new version is at: https://github.com/platformsh/cli
https://docs.platform.sh/administration/cli.html
MIT License
224 stars 121 forks source link

Autocompletion not working on Windows with a fresh install #1171

Open lolautruche opened 1 year ago

lolautruche commented 1 year ago

On Windows 10, using Git Bash, after the regular setup, the autocompletion outputs the following message:

$ platform bash: C:UsersIEUser.platformshbinplatform: command not found

It seems that the \ character is stripped in the path. Having a look at the generated autocompletion.sh, I figured out that the path to the platform CLI is not quoted, and the \ are not doubled.

I was able to fix the issue by replacing:

RESULT=$(C:\Users\IEUser\.platformsh\bin\platform _completion --shell-type bash >/dev/null)

by:

RESULT=$("C:\Users\IEUser\.platformsh\bin\platform" _completion --shell-type bash >/dev/null)

After this change, and after sourcing ~/.bashrc, the autocompletion works. It ouputs another error, but probably related to the Windows Bash implementation:

__ltrim_colon_completions: command not found
lolautruche commented 1 year ago

The autocompletion script generation is done in stecman/symfony-console-completion, which is called by the self:install command. The program path is directly passed here.

1174 adds quotes around it.