mirror of https://github.com/chriskiehl/Gooey.git
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.
30 lines
939 B
30 lines
939 B
from collections import OrderedDict
|
|
|
|
|
|
def positional(actions):
|
|
groups = OrderedDict([('Positional Arguments', []), ('Optional Arguments', [])])
|
|
for action in actions:
|
|
if action['group_name'] == 'Positional Arguments':
|
|
groups['Positional Arguments'].append(action)
|
|
else:
|
|
groups['Optional Arguments'].append(action)
|
|
return groups
|
|
|
|
|
|
def requiredAndOptional(actions):
|
|
groups = OrderedDict([('Required', []), ('Optional', [])])
|
|
for action in actions:
|
|
if action['required']:
|
|
groups['Required'].append(action)
|
|
else:
|
|
groups['Optional'].append(action)
|
|
return groups
|
|
|
|
|
|
def argparseGroups(actions):
|
|
groups = OrderedDict()
|
|
for action in actions:
|
|
if action['group_name'] not in groups:
|
|
groups[action['group_name']] = []
|
|
groups[action['group_name']].append(action)
|
|
return groups
|