nercone-modern 1.3.0__tar.gz → 1.4.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {nercone_modern-1.3.0 → nercone_modern-1.4.5}/PKG-INFO +42 -7
- {nercone_modern-1.3.0 → nercone_modern-1.4.5}/README.md +40 -5
- {nercone_modern-1.3.0 → nercone_modern-1.4.5}/pyproject.toml +2 -2
- nercone_modern-1.4.5/src/nercone_modern/color.py +38 -0
- nercone_modern-1.4.5/src/nercone_modern/text.py +24 -0
- {nercone_modern-1.3.0 → nercone_modern-1.4.5}/src/nercone_modern/__init__.py +0 -0
- {nercone_modern-1.3.0 → nercone_modern-1.4.5}/src/nercone_modern/__main__.py +0 -0
- {nercone_modern-1.3.0 → nercone_modern-1.4.5}/src/nercone_modern/logging.py +0 -0
- {nercone_modern-1.3.0 → nercone_modern-1.4.5}/src/nercone_modern/progressbar.py +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: nercone-modern
|
|
3
|
-
Version: 1.
|
|
4
|
-
Summary: Modern
|
|
3
|
+
Version: 1.4.5
|
|
4
|
+
Summary: Modern CLI Library
|
|
5
5
|
Author: Nercone
|
|
6
6
|
Author-email: Nercone <nercone@diamondgotcat.net>
|
|
7
7
|
License: MIT
|
|
@@ -16,7 +16,7 @@ Description-Content-Type: text/markdown
|
|
|
16
16
|
<img width="1920" alt="Nercone Modern" src="https://github.com/user-attachments/assets/c92b0407-916f-46ec-9116-c3388b38c88c" />
|
|
17
17
|
|
|
18
18
|
# nercone-modern
|
|
19
|
-
Modern
|
|
19
|
+
Modern CLI Library
|
|
20
20
|
|
|
21
21
|
## Installation
|
|
22
22
|
|
|
@@ -38,28 +38,63 @@ pip3 install nercone-modern
|
|
|
38
38
|
|
|
39
39
|
## Usage
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
### Import
|
|
42
42
|
|
|
43
43
|
```python
|
|
44
|
+
from nercone_modern.color import ModernColor
|
|
45
|
+
from nercone_modern.text import ModernText
|
|
44
46
|
from nercone_modern.logging import ModernLogging
|
|
45
47
|
from nercone_modern.progressbar import ModernProgressBar
|
|
46
48
|
```
|
|
47
49
|
|
|
48
|
-
|
|
50
|
+
### Color
|
|
51
|
+
```python
|
|
52
|
+
from nercone_modern.color import ModernColor as Color
|
|
53
|
+
print(f"Build {Color.GREEN}Success{Color.RESET}")
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
**Supported colors:**
|
|
57
|
+
- `CYAN`
|
|
58
|
+
- `MAGENTA`
|
|
59
|
+
- `YELLOW`
|
|
60
|
+
- `GREEN`
|
|
61
|
+
- `RED`
|
|
62
|
+
- `BLUE`
|
|
63
|
+
- `WHITE`
|
|
64
|
+
- `BLACK`
|
|
65
|
+
- `GRAY`
|
|
66
|
+
- `RESET`
|
|
67
|
+
|
|
68
|
+
### Text
|
|
69
|
+
```python
|
|
70
|
+
from nercone_modern.text import ModernText as Text
|
|
71
|
+
from nercone_modern.color import ModernColor as Color
|
|
72
|
+
print("Build" + Text("Success", color="green"))
|
|
73
|
+
print("Build" + Text("Failed", color=Color.RED))
|
|
74
|
+
```
|
|
49
75
|
|
|
76
|
+
### Logging
|
|
50
77
|
```python
|
|
78
|
+
from nercone_modern.logging import ModernLogging
|
|
51
79
|
logger = ModernLogging("Main", display_level="DEBUG")
|
|
52
80
|
logger.log("This is a test message", level="INFO")
|
|
53
81
|
answer = logger.prompt("What's your name?", level="INFO")
|
|
54
82
|
logger.log(f"Answer: {answer}", level="DEBUG")
|
|
55
83
|
```
|
|
56
84
|
|
|
57
|
-
**
|
|
85
|
+
**Supported levels:**
|
|
86
|
+
- `DEBUG`
|
|
87
|
+
- `INFO`
|
|
88
|
+
- `WARN`
|
|
89
|
+
- `ERROR`
|
|
90
|
+
- `CRITICAL`
|
|
58
91
|
|
|
92
|
+
### Progress Bar
|
|
59
93
|
```python
|
|
94
|
+
from nercone_modern.progressbar import ModernProgressBar
|
|
60
95
|
progress_bar = ModernProgressBar(total=100, process_name="Task 1", spinner_mode=True)
|
|
61
|
-
progress_bar.start()
|
|
62
96
|
|
|
97
|
+
progress_bar.start()
|
|
63
98
|
time.sleep(5)
|
|
64
99
|
|
|
65
100
|
progress_bar.spinner(False)
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<img width="1920" alt="Nercone Modern" src="https://github.com/user-attachments/assets/c92b0407-916f-46ec-9116-c3388b38c88c" />
|
|
3
3
|
|
|
4
4
|
# nercone-modern
|
|
5
|
-
Modern
|
|
5
|
+
Modern CLI Library
|
|
6
6
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
@@ -24,28 +24,63 @@ pip3 install nercone-modern
|
|
|
24
24
|
|
|
25
25
|
## Usage
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
### Import
|
|
28
28
|
|
|
29
29
|
```python
|
|
30
|
+
from nercone_modern.color import ModernColor
|
|
31
|
+
from nercone_modern.text import ModernText
|
|
30
32
|
from nercone_modern.logging import ModernLogging
|
|
31
33
|
from nercone_modern.progressbar import ModernProgressBar
|
|
32
34
|
```
|
|
33
35
|
|
|
34
|
-
|
|
36
|
+
### Color
|
|
37
|
+
```python
|
|
38
|
+
from nercone_modern.color import ModernColor as Color
|
|
39
|
+
print(f"Build {Color.GREEN}Success{Color.RESET}")
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
**Supported colors:**
|
|
43
|
+
- `CYAN`
|
|
44
|
+
- `MAGENTA`
|
|
45
|
+
- `YELLOW`
|
|
46
|
+
- `GREEN`
|
|
47
|
+
- `RED`
|
|
48
|
+
- `BLUE`
|
|
49
|
+
- `WHITE`
|
|
50
|
+
- `BLACK`
|
|
51
|
+
- `GRAY`
|
|
52
|
+
- `RESET`
|
|
53
|
+
|
|
54
|
+
### Text
|
|
55
|
+
```python
|
|
56
|
+
from nercone_modern.text import ModernText as Text
|
|
57
|
+
from nercone_modern.color import ModernColor as Color
|
|
58
|
+
print("Build" + Text("Success", color="green"))
|
|
59
|
+
print("Build" + Text("Failed", color=Color.RED))
|
|
60
|
+
```
|
|
35
61
|
|
|
62
|
+
### Logging
|
|
36
63
|
```python
|
|
64
|
+
from nercone_modern.logging import ModernLogging
|
|
37
65
|
logger = ModernLogging("Main", display_level="DEBUG")
|
|
38
66
|
logger.log("This is a test message", level="INFO")
|
|
39
67
|
answer = logger.prompt("What's your name?", level="INFO")
|
|
40
68
|
logger.log(f"Answer: {answer}", level="DEBUG")
|
|
41
69
|
```
|
|
42
70
|
|
|
43
|
-
**
|
|
71
|
+
**Supported levels:**
|
|
72
|
+
- `DEBUG`
|
|
73
|
+
- `INFO`
|
|
74
|
+
- `WARN`
|
|
75
|
+
- `ERROR`
|
|
76
|
+
- `CRITICAL`
|
|
44
77
|
|
|
78
|
+
### Progress Bar
|
|
45
79
|
```python
|
|
80
|
+
from nercone_modern.progressbar import ModernProgressBar
|
|
46
81
|
progress_bar = ModernProgressBar(total=100, process_name="Task 1", spinner_mode=True)
|
|
47
|
-
progress_bar.start()
|
|
48
82
|
|
|
83
|
+
progress_bar.start()
|
|
49
84
|
time.sleep(5)
|
|
50
85
|
|
|
51
86
|
progress_bar.spinner(False)
|
|
@@ -4,8 +4,8 @@ build-backend = "uv_build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "nercone-modern"
|
|
7
|
-
version = "1.
|
|
8
|
-
description = "Modern
|
|
7
|
+
version = "1.4.5"
|
|
8
|
+
description = "Modern CLI Library"
|
|
9
9
|
readme = { file = "README.md", content-type = "text/markdown" }
|
|
10
10
|
authors = [
|
|
11
11
|
{ name = "Nercone", email = "nercone@diamondgotcat.net" }
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
class ModernColor:
|
|
2
|
+
def ansi_color_by_code(color_code: int | str = 0):
|
|
3
|
+
return f"\033[{color_code}m"
|
|
4
|
+
|
|
5
|
+
def ansi_color(color_name: str = "reset"):
|
|
6
|
+
if color_name == "reset":
|
|
7
|
+
return ModernColor.ansi_color_by_code(0)
|
|
8
|
+
elif color_name == "black":
|
|
9
|
+
return ModernColor.ansi_color_by_code(30)
|
|
10
|
+
elif color_name == "red":
|
|
11
|
+
return ModernColor.ansi_color_by_code(31)
|
|
12
|
+
elif color_name == "green":
|
|
13
|
+
return ModernColor.ansi_color_by_code(32)
|
|
14
|
+
elif color_name == "yellow":
|
|
15
|
+
return ModernColor.ansi_color_by_code(33)
|
|
16
|
+
elif color_name == "blue":
|
|
17
|
+
return ModernColor.ansi_color_by_code(34)
|
|
18
|
+
elif color_name == "magenta":
|
|
19
|
+
return ModernColor.ansi_color_by_code(35)
|
|
20
|
+
elif color_name == "cyan":
|
|
21
|
+
return ModernColor.ansi_color_by_code(36)
|
|
22
|
+
elif color_name == "white":
|
|
23
|
+
return ModernColor.ansi_color_by_code(37)
|
|
24
|
+
elif color_name in ("gray", "grey"):
|
|
25
|
+
return ModernColor.ansi_color_by_code(90)
|
|
26
|
+
else:
|
|
27
|
+
return ""
|
|
28
|
+
|
|
29
|
+
RESET = "\033[0m"
|
|
30
|
+
BLACK = "\033[30m"
|
|
31
|
+
RED = "\033[31m"
|
|
32
|
+
GREEN = "\033[32m"
|
|
33
|
+
YELLOW = "\033[33m"
|
|
34
|
+
BLUE = "\033[34m"
|
|
35
|
+
MAGENTA = "\033[35m"
|
|
36
|
+
CYAN = "\033[36m"
|
|
37
|
+
WHITE = "\033[37m"
|
|
38
|
+
GRAY = "\033[90m"
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
from typing import Union
|
|
2
|
+
from .color import ModernColor
|
|
3
|
+
|
|
4
|
+
class ModernText:
|
|
5
|
+
def __init__(self, content="", color: str = ModernColor.WHITE):
|
|
6
|
+
self.content = content
|
|
7
|
+
if not color.startswith("\033"):
|
|
8
|
+
color = getattr(ModernColor, color.upper(), ModernColor.WHITE)
|
|
9
|
+
self.color = color
|
|
10
|
+
|
|
11
|
+
def __add__(self, other: Union[str, "ModernText"]):
|
|
12
|
+
if isinstance(other, ModernText):
|
|
13
|
+
if self.color == other.color:
|
|
14
|
+
return ModernText(self.content + other.content, self.color)
|
|
15
|
+
else:
|
|
16
|
+
combined = f"{self.color}{self.content}{ModernColor.RESET}{other.color}{other.content}"
|
|
17
|
+
return ModernText(combined, ModernColor.RESET)
|
|
18
|
+
elif isinstance(other, str):
|
|
19
|
+
return ModernText(self.content + other, self.color)
|
|
20
|
+
else:
|
|
21
|
+
raise TypeError(f"Unsupported operand type(s) for +: 'ModernText' and '{type(other).__name__}'")
|
|
22
|
+
|
|
23
|
+
def __str__(self):
|
|
24
|
+
return f"{self.color}{self.content}{ModernColor.RESET}"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|