fix: Set parser.prog for shtab completion compatibility

This commit is contained in:
Paul Gauthier (aider) 2025-05-08 14:29:40 -07:00
parent 30097ab859
commit 217b45ae88

View file

@ -878,7 +878,8 @@ def main():
print(f"Supported shells are: {', '.join(shtab.SUPPORTED_SHELLS)}", file=sys.stderr)
sys.exit(1)
parser = get_parser([], None)
print(shtab.complete(parser, shell=shell, prog="aider"))
parser.prog = "aider" # Set the program name on the parser
print(shtab.complete(parser, shell=shell))
else:
print("Error: Please specify a shell for completion.", file=sys.stderr)
print(f"Usage: python {sys.argv[0]} completion <shell_name>", file=sys.stderr)