You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The _is_incomplete_option function in the Click library has a logic issue in its loop that sets the last_option variable. The function does not break the loop after assigning last_option, which leads to wrong shell completion.
We can reproduce issue If we have flag option before tuple option
Environment:
Python version: 3.11
Click version: 8.1.7
Possible solution :
Once we identify the last option we have the break the loop in _is_incomplete_option function
def_is_incomplete_option(ctx: Context, args: t.List[str], param: Parameter) ->bool:
"""Determine if the given parameter is an option that needs a value. :param args: List of complete args before the incomplete value. :param param: Option object being checked. """ifnotisinstance(param, Option):
returnFalseifparam.is_flagorparam.count:
returnFalselast_option=Noneforindex, arginenumerate(reversed(args)):
ifindex+1>param.nargs:
breakif_start_of_option(ctx, arg):
last_option=argbreak# <-------------------------------------------------- break the loop on finding the optionreturnlast_optionisnotNoneandlast_optioninparam.opts
The text was updated successfully, but these errors were encountered:
The _is_incomplete_option function in the Click library has a logic issue in its loop that sets the last_option variable. The function does not break the loop after assigning last_option, which leads to wrong shell completion.
Replication:
See https://github.com/msaipraneeth/click-tuple-param
RCA:
We can reproduce issue If we have flag option before tuple option
Environment:
Possible solution :
Once we identify the last option we have the break the loop in _is_incomplete_option function
The text was updated successfully, but these errors were encountered: