You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
580 B

  1. from itertools import chain
  2. from copy import deepcopy
  3. from gooey.util.functional import compact
  4. def buildCliString(target, cmd, positional, optional, suppress_gooey_flag=False):
  5. positionals = deepcopy(positional)
  6. if positionals:
  7. positionals.insert(0, "--")
  8. cmd_string = ' '.join(compact(chain(optional, positionals)))
  9. if cmd != '::gooey/default':
  10. cmd_string = u'{} {}'.format(cmd, cmd_string)
  11. ignore_flag = '' if suppress_gooey_flag else '--ignore-gooey'
  12. return u'{} {} {}'.format(target, ignore_flag, cmd_string)