how to use flag in actions

8 views
Skip to first unread message

Vikas Kumar

unread,
Dec 20, 2020, 7:12:56 AM12/20/20
to python-doit
I am looking to use the flag such that

doit tf_init  runs terraform init command
and 
doit tf_init --upgrade runs terraform init -upgrade command


This is my pseudo code
def task_tf_init():
   def _task(flag):
      if flag:
          return '-upgrade'
       else:
           return ''

return {
'params': [{
'name': 'flag',
'long': 'upgrade',
'short': 'u',
'type': bool,
'default': False,
'inverse': 'upgrade'}],

'actions': [f'terraform init {(_task, )}',],
'verbosity': 2,
}

Reply all
Reply to author
Forward
0 new messages