smbclientng.core.Config

 1#!/usr/bin/env python3
 2# -*- coding: utf-8 -*-
 3# File name          : Config.py
 4# Author             : Podalirius (@podalirius_)
 5# Date created       : 31 may 2024
 6
 7import platform
 8
 9
10class Config(object):
11    """
12    Configuration handler for smbclientng.
13
14    This class manages the configuration settings for the smbclientng tool, including debug and color output settings.
15    It provides a structured way to access and modify these settings throughout the application.
16
17    Attributes:
18        _debug (bool): Flag to enable or disable debug mode.
19        _no_colors (bool): Flag to enable or disable colored output, depending on the platform.
20
21    Methods:
22        debug: Property to get or set the debug mode.
23        no_colors: Property to get or set the colored output preference.
24    """
25
26    not_interactive = False
27    startup_script = None
28
29    def __init__(self, debug=False, no_colors=None):
30        self._debug = debug
31
32        if no_colors is not None:
33            self._no_colors = no_colors
34        else:
35            if platform.system() == "Windows":
36                self._no_colors = False
37            else:
38                self._no_colors = True
39
40    @property
41    def debug(self):
42        return self._debug
43
44    @debug.setter
45    def debug(self, value):
46        if isinstance(value, bool):
47            self._debug = value
48        else:
49            raise ValueError("Debug must be a boolean value")
50
51    @property
52    def no_colors(self):
53        return self._no_colors
54
55    @no_colors.setter
56    def no_colors(self, value):
57        if isinstance(value, bool):
58            self._no_colors = value
59        else:
60            raise ValueError("Colored output must be a boolean value")
class Config:
11class Config(object):
12    """
13    Configuration handler for smbclientng.
14
15    This class manages the configuration settings for the smbclientng tool, including debug and color output settings.
16    It provides a structured way to access and modify these settings throughout the application.
17
18    Attributes:
19        _debug (bool): Flag to enable or disable debug mode.
20        _no_colors (bool): Flag to enable or disable colored output, depending on the platform.
21
22    Methods:
23        debug: Property to get or set the debug mode.
24        no_colors: Property to get or set the colored output preference.
25    """
26
27    not_interactive = False
28    startup_script = None
29
30    def __init__(self, debug=False, no_colors=None):
31        self._debug = debug
32
33        if no_colors is not None:
34            self._no_colors = no_colors
35        else:
36            if platform.system() == "Windows":
37                self._no_colors = False
38            else:
39                self._no_colors = True
40
41    @property
42    def debug(self):
43        return self._debug
44
45    @debug.setter
46    def debug(self, value):
47        if isinstance(value, bool):
48            self._debug = value
49        else:
50            raise ValueError("Debug must be a boolean value")
51
52    @property
53    def no_colors(self):
54        return self._no_colors
55
56    @no_colors.setter
57    def no_colors(self, value):
58        if isinstance(value, bool):
59            self._no_colors = value
60        else:
61            raise ValueError("Colored output must be a boolean value")

Configuration handler for smbclientng.

This class manages the configuration settings for the smbclientng tool, including debug and color output settings. It provides a structured way to access and modify these settings throughout the application.

Attributes: _debug (bool): Flag to enable or disable debug mode. _no_colors (bool): Flag to enable or disable colored output, depending on the platform.

Methods: debug: Property to get or set the debug mode. no_colors: Property to get or set the colored output preference.

Config(debug=False, no_colors=None)
30    def __init__(self, debug=False, no_colors=None):
31        self._debug = debug
32
33        if no_colors is not None:
34            self._no_colors = no_colors
35        else:
36            if platform.system() == "Windows":
37                self._no_colors = False
38            else:
39                self._no_colors = True
not_interactive = False
startup_script = None
debug
41    @property
42    def debug(self):
43        return self._debug
no_colors
52    @property
53    def no_colors(self):
54        return self._no_colors