1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Fix ansible-test target completion on Python 3.

This commit is contained in:
Matt Clay 2017-08-15 15:05:31 -07:00
parent ebbb5369b5
commit 0ff5815a4f

View file

@ -7,6 +7,7 @@ import re
import errno
import itertools
import abc
import sys
from lib.util import ApplicationError
@ -21,7 +22,8 @@ def find_target_completion(target_func, prefix):
"""
try:
targets = target_func()
prefix = prefix.encode()
if sys.version_info[0] == 2:
prefix = prefix.encode()
short = os.environ.get('COMP_TYPE') == '63' # double tab completion from bash
matches = walk_completion_targets(targets, prefix, short)
return matches