-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathconfig.py
More file actions
78 lines (58 loc) · 1.49 KB
/
config.py
File metadata and controls
78 lines (58 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
"""
Contains config for the commitlint.
"""
from typing import Optional
class _CommitlintConfig:
"""
Singleton class for storing commitlint configs
"""
_instance: Optional["_CommitlintConfig"] = None # for singleton property
_verbose: bool = False
_quiet: bool = False
def __new__(cls) -> "_CommitlintConfig":
"""
Return singleton instance.
"""
if cls._instance is None:
cls._instance = super().__new__(cls)
return cls._instance
@property
def verbose(self) -> bool:
"""
Get the current verbose setting.
Returns:
bool: The current verbose setting.
"""
return self._verbose
@verbose.setter
def verbose(self, value: bool) -> None:
"""
Set the verbose setting.
Args:
value (bool): New value for verbose setting.
"""
if value:
self._quiet = False
self._verbose = value
@property
def quiet(self) -> bool:
"""
Get the current quiet setting.
Returns:
bool: The current quiet setting.
"""
return self._quiet
@quiet.setter
def quiet(self, value: bool) -> None:
"""
Set the quiet setting.
Args:
value (bool): New value for quiet setting.
"""
if value:
self._verbose = False
self._quiet = value
config = _CommitlintConfig()
__all__ = [
"config",
]