blob: 7f038b1060e8422cd1eead3628fc12829884d2d7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
import vim
import os
if "PYTEST_VERSION" in os.environ:
from utils import *
roles_py_imported = True
def load_ai_role_names(command_type):
roles = read_role_files()
enhance_roles_with_custom_function(roles)
role_names = set()
for name in roles.sections():
parts = name.split('.')
if command_type == 'image':
# special case - image type have to be explicitely defined
if len(parts) > 1 and parts[-1] == command_type:
role_names.add(parts[0])
else:
if len(parts) == 1 or parts[-1] == command_type:
role_names.add(parts[0])
role_names = [name for name in role_names if name != DEFAULT_ROLE_NAME]
return list(role_names)
|