Coverage for src/types/commands.py: 100.00%

12 statements  

« prev     ^ index     » next       coverage.py v7.15.4, created at 2026-08-22 10:53 +0000

1#!/usr/bin/env python3 

2 

3# Standard libraries 

4from typing import List 

5 

6# Commands class, pylint: disable=too-few-public-methods 

7class Commands: 

8 

9 # Members 

10 __arguments: List[str] 

11 

12 # Constructor 

13 def __init__(self, arguments: List[str]) -> None: 

14 

15 # Prepare arguments 

16 if isinstance(arguments, list): 

17 self.__arguments = arguments 

18 else: # pragma: no cover 

19 self.__arguments = [] 

20 

21 # Getter 

22 def get(self) -> str: 

23 

24 # Variables 

25 command: List[str] = [] 

26 

27 # Prepare command 

28 for argument in self.__arguments: 

29 

30 # Quoted argument 

31 if ' ' in argument: 

32 command += [f'\'{argument}\''] 

33 

34 # Standard argument 

35 else: 

36 command += [argument] 

37 

38 # Result 

39 return ' '.join(command)