Skip to content

[BUG] MSYS2 Bash and Git Bash for Windows autocomplete get ^M between autocomplete options #202

@aslakrin

Description

@aslakrin

Describe the bug

Somewhere along the line it seems an \r gets introduced between the available options in git bash on windows. This is also the case for MSYS2. Seems not to be for zsh under msys2.

To Reproduce

Steps to reproduce the behavior with a minimum self-contained file.

Replace each part with your own scenario:

  • Create a file main.py with:
import typer

app = typer.Typer()


@app.command()
def hello(name: str):
    typer.echo(f"Hello {name}")

@app.command()
def goodbye(name: str):
    typer.echo(f"Goodbye {name}")

if __name__ == "__main__":
    app()
  • Call it with:
typer main.py run <TAB><TAB>
  • It outputs:
goodbye^M  hello      
  • But I expected it to output:
goodbye hello      

Expected behavior

I do not expect extra carriage returns to appear as control characters

Environment

  • OS: Windows
  • Typer Version 0.3.2
  • Python version 3.8.3

Additional context

Operates normally when APP_COMPLETE=complete_bash $1 ) is changed to APP_COMPLETE=complete_bash $1 | tr -d '\r' ) in the completion file, but this is probably not a good fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions