Skip to content

Commit

Permalink
fix default value set for bool type (#273)
Browse files Browse the repository at this point in the history
  • Loading branch information
AllyW authored Jul 20, 2023
1 parent 11f2454 commit 6049784
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion knack/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,10 @@ def update_argument(self, param_name, argtype):
# that coincides with the default
if isinstance(arg_default, str):
arg_default = DefaultStr(arg_default)
elif isinstance(arg_default, int):
elif isinstance(arg_default, int) and not isinstance(arg_default, bool):
# bool's is_default is ignored for now, because
# 1. bool is a subclass of int, so isinstance(True, int) cannot distinguish between int and bool
# 2. bool is not extendable according to https://stackoverflow.com/a/2172204/2199657
arg_default = DefaultInt(arg_default)
# update the default
if arg_default:
Expand Down

0 comments on commit 6049784

Please sign in to comment.