File size: 687 Bytes
d5436e0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from ..basic.documentation import DocumentationHandler
from ..utils.read_yaml import load_commands_from_yaml


def build_command_chain():
    commands = load_commands_from_yaml(file_path="../commands.yaml")
    handlers = None
    for cmd_data in commands:
        command_dict = cmd_data.get('command_dict', {})
        commands_list = [cmd.lower() for cmds in command_dict.values() for cmd in cmds]
        description = cmd_data.get('description', '')

        if description.lower() == "download text file with all commands":
            handler = DocumentationHandler(commands_list, handlers)
        else:
            handler = None

        handlers = handler
    return handlers