Skip to content

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

@liooil

Description

@liooil

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions