Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bash completion not working in git-for-windows #2461

Closed
liooil opened this issue Mar 3, 2023 · 1 comment · Fixed by #2462
Closed

bash completion not working in git-for-windows #2461

liooil opened this issue Mar 3, 2023 · 1 comment · Fixed by #2462
Milestone

Comments

@liooil
Copy link
Contributor

liooil commented Mar 3, 2023

Environment:

  • Python version: 3.8.10
  • Click version: 8.1.3
  • Git for Windows version: 2.39.2
  • Bash version: 5.2.12(1)-release

Step to replicate:

  1. build a command line executable aaa.exe with click
  2. add eval "$(_CCM_COMPLETE=bash_source ccm)" to ~/.bashrc
  3. start a new bash session
  4. see error reported

Error reported:

e/bin/bash: -c: line 0: syntax error near unexpected token `('
/bin/bash: -c: line 0: `echo 5.2.12(1)-release'
Traceback (most recent call last):
  File "C:\Python38\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Python38\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Python38\Scripts\aaa.exe\__main__.py", line 7, in <module>
  File "C:\Python38\lib\site-packages\click\core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "C:\Python38\lib\site-packages\click\core.py", line 1050, in main
    self._main_shell_completion(extra, prog_name, complete_var)
  File "C:\Python38\lib\site-packages\click\core.py", line 1125, in _main_shell_completion
    rv = shell_complete(self, ctx_args, prog_name, complete_var, instruction)
  File "C:\Python38\lib\site-packages\click\shell_completion.py", line 45, in shell_complete
    echo(comp.source())
  File "C:\Python38\lib\site-packages\click\shell_completion.py", line 326, in source
    self._check_version()
  File "C:\Python38\lib\site-packages\click\shell_completion.py", line 321, in _check_version
    raise RuntimeError(
RuntimeError: Couldn't detect Bash version, shell completion is not supported.
liooil added a commit to liooil/click that referenced this issue Mar 3, 2023
wrap BASH_VERSION with "" to avoid "(" ")" in BASH_VERSION
@davidism
Copy link
Member

davidism commented Mar 3, 2023

Nice catch, and thanks for the PR.

@davidism davidism added this to the 8.1.4 milestone Mar 3, 2023
@davidism davidism linked a pull request Jun 29, 2023 that will close this issue
6 tasks
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants