File size: 335 Bytes
d5436e0
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
import yaml
import logging
from typing import Optional, Any


def load_commands_from_yaml(file_path: Optional[str] = None) -> Any:
    try:
        with open(file_path, 'r') as file:
            commands_data = yaml.safe_load(file)
            return commands_data.get('commands', [])
    except IOError as e:
        logging.error(e)