Skip to content

Commit 48fb170

Browse files
authored
minor fix (issue when assigning optional parameters 'store_true')
1 parent 5012b07 commit 48fb170

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

src/flexistack/flexistack.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -587,9 +587,15 @@ def _load(_directory, _parser, _subparser):
587587
_narg = next((item.value.value for item in parg.value.keywords if item.arg == 'nargs'), None)
588588
_tp = next((eval(item.value.id) for item in parg.value.keywords if item.arg == 'type'), None)
589589
if len(v) == 2:
590-
__subparser.add_argument(v[0],v[1],type=_tp,nargs=_narg,action=_act,help=_des)
590+
if _act == 'store_true':
591+
__subparser.add_argument(v[0],v[1],action=_act,help=_des)
592+
else:
593+
__subparser.add_argument(v[0],v[1],type=_tp,nargs=_narg,action=_act,help=_des)
591594
elif len(v) == 1:
592-
__subparser.add_argument(v[0],type=_tp,nargs=_narg,action=_act,help=_des)
595+
if _act == 'store_true':
596+
__subparser.add_argument(v[0],action=_act,help=_des)
597+
else:
598+
__subparser.add_argument(v[0],type=_tp,nargs=_narg,action=_act,help=_des)
593599
self.dprint(3, "cmp", "Loaded!")
594600
found = True
595601
break
@@ -923,4 +929,4 @@ def plugin_init(self, flexistack=None):
923929

924930
#########################################################################################
925931
# EOF #
926-
#########################################################################################
932+
#########################################################################################

0 commit comments

Comments
 (0)