Coverage for src / eclipse / care / utils / cli_utils.py: 100%

8 statements  

« prev     ^ index     » next       coverage.py v7.13.5, created at 2026-03-24 09:38 +0100

1# Copyright (c) 2025 The Eclipse Foundation 

2# 

3# This program and the accompanying materials are made available under the 

4# terms of the Eclipse Public License 2.0 which is available at 

5# http://www.eclipse.org/legal/epl-2.0. 

6# 

7# SPDX-License-Identifier: EPL-2.0 

8# 

9# Contributors: 

10# asgomes - Initial implementation 

11 

12import sys 

13 

14from colorama import Fore, Style 

15 

16 

17def print_debug(message): 

18 """ 

19 Prints a debug message to the console in blue. 

20 

21 The message is prefixed with '[DEBUG]' and displayed using 

22 colorama for cross-platform colored terminal output. 

23 

24 Parameters 

25 ---------- 

26 message : str 

27 The string content of the error message. 

28 """ 

29 print(f"{Fore.BLUE}[DEBUG] {message}{Style.RESET_ALL}", file=sys.stdout) 

30 

31 

32def print_error(message): 

33 """ 

34 Prints an error message to the console in red. 

35 

36 The message is prefixed with '[ERROR]' and displayed using 

37 colorama for cross-platform colored terminal output. 

38  

39 Parameters 

40 ---------- 

41 message : str 

42 The string content of the error message. 

43 """ 

44 print(f"{Fore.RED}[ERROR] {message}{Style.RESET_ALL}", file=sys.stderr) 

45 

46 

47def print_warning(message): 

48 """ 

49 Prints a warning message to the console in yellow. 

50 

51 The message is prefixed with '[WARNING]' and displayed using 

52 colorama for cross-platform colored terminal output. 

53  

54 Parameters 

55 ---------- 

56 message : str 

57 The string content of the warning message. 

58 """ 

59 print(f"{Fore.YELLOW}[WARNING] {message}{Style.RESET_ALL}", file=sys.stderr)