termcraft 0.1.0__py3-none-any.whl
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.
- termcraft/__init__.py +25 -0
- termcraft/banners.py +32 -0
- termcraft/borders.py +13 -0
- termcraft/boxes.py +21 -0
- termcraft/colors.py +41 -0
- termcraft/emoji/__init__.py +17 -0
- termcraft/emoji/banner.py +7 -0
- termcraft/emoji/emoji.py +24 -0
- termcraft/emoji/loader.py +14 -0
- termcraft/emoji/react.py +6 -0
- termcraft/emoji/sets.py +13 -0
- termcraft/emoji/status.py +7 -0
- termcraft/emoji/weather.py +6 -0
- termcraft/icons.py +16 -0
- termcraft/jsonview.py +20 -0
- termcraft/lists.py +9 -0
- termcraft/progress.py +24 -0
- termcraft/styles.py +30 -0
- termcraft/tables.py +70 -0
- termcraft/trees.py +18 -0
- termcraft-0.1.0.dist-info/METADATA +63 -0
- termcraft-0.1.0.dist-info/RECORD +24 -0
- termcraft-0.1.0.dist-info/WHEEL +5 -0
- termcraft-0.1.0.dist-info/top_level.txt +1 -0
termcraft/__init__.py
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
from .colors import colorize, Colors
|
|
2
|
+
from .styles import set_theme, get_theme
|
|
3
|
+
from .banners import title, success, error, warning, info
|
|
4
|
+
from .borders import draw_line, separator
|
|
5
|
+
from .boxes import message
|
|
6
|
+
from .tables import dict_ui, table
|
|
7
|
+
from .lists import bullet, numbered
|
|
8
|
+
from .trees import tree
|
|
9
|
+
from .progress import progress, spinner
|
|
10
|
+
from .jsonview import json_view
|
|
11
|
+
from .icons import icon
|
|
12
|
+
|
|
13
|
+
__all__ = [
|
|
14
|
+
"colorize", "Colors",
|
|
15
|
+
"set_theme", "get_theme",
|
|
16
|
+
"title", "success", "error", "warning", "info",
|
|
17
|
+
"draw_line", "separator",
|
|
18
|
+
"message",
|
|
19
|
+
"dict_ui", "table",
|
|
20
|
+
"bullet", "numbered",
|
|
21
|
+
"tree",
|
|
22
|
+
"progress", "spinner",
|
|
23
|
+
"json_view",
|
|
24
|
+
"icon"
|
|
25
|
+
]
|
termcraft/banners.py
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
from .styles import get_theme
|
|
2
|
+
from .colors import colorize
|
|
3
|
+
|
|
4
|
+
def title(text: str, color: str = "cyan", align: str = "left", width: int = 50):
|
|
5
|
+
theme = get_theme()
|
|
6
|
+
top = theme["tl"] + theme["h"] * (width - 2) + theme["tr"]
|
|
7
|
+
bottom = theme["bl"] + theme["h"] * (width - 2) + theme["br"]
|
|
8
|
+
|
|
9
|
+
if align == "center":
|
|
10
|
+
content = text.center(width - 4)
|
|
11
|
+
elif align == "right":
|
|
12
|
+
content = text.rjust(width - 4)
|
|
13
|
+
else:
|
|
14
|
+
content = text.ljust(width - 4)
|
|
15
|
+
|
|
16
|
+
middle = f"{theme['v']} {content} {theme['v']}"
|
|
17
|
+
|
|
18
|
+
print(colorize(top, color))
|
|
19
|
+
print(colorize(middle, color, bold=True))
|
|
20
|
+
print(colorize(bottom, color))
|
|
21
|
+
|
|
22
|
+
def success(text: str):
|
|
23
|
+
print(colorize(f"✔ {text}", color="green", bold=True))
|
|
24
|
+
|
|
25
|
+
def error(text: str):
|
|
26
|
+
print(colorize(f"✖ {text}", color="red", bold=True))
|
|
27
|
+
|
|
28
|
+
def warning(text: str):
|
|
29
|
+
print(colorize(f"⚠ {text}", color="yellow", bold=True))
|
|
30
|
+
|
|
31
|
+
def info(text: str):
|
|
32
|
+
print(colorize(f"ℹ {text}", color="blue", bold=True))
|
termcraft/borders.py
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from .styles import get_theme
|
|
2
|
+
from .colors import colorize
|
|
3
|
+
|
|
4
|
+
def draw_line(length: int = 50, color: str = "") -> str:
|
|
5
|
+
theme = get_theme()
|
|
6
|
+
line = theme["h"] * length
|
|
7
|
+
return colorize(line, color)
|
|
8
|
+
|
|
9
|
+
def separator(length: int = 50, color: str = "black", bold: bool = True) -> str:
|
|
10
|
+
# Use bold black as a dim color if the terminal supports it
|
|
11
|
+
theme = get_theme()
|
|
12
|
+
line = theme["h"] * length
|
|
13
|
+
return colorize(line, color, bold=bold)
|
termcraft/boxes.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
from .styles import get_theme
|
|
2
|
+
from .colors import colorize
|
|
3
|
+
|
|
4
|
+
def message(text: str, title: str = "", color: str = "", width: int = 50):
|
|
5
|
+
theme = get_theme()
|
|
6
|
+
top = theme["tl"] + theme["h"] * (width - 2) + theme["tr"]
|
|
7
|
+
if title:
|
|
8
|
+
title_str = f" {title} "
|
|
9
|
+
if len(title_str) < width - 2:
|
|
10
|
+
top = theme["tl"] + theme["h"] + title_str + theme["h"] * (width - 3 - len(title_str)) + theme["tr"]
|
|
11
|
+
|
|
12
|
+
bottom = theme["bl"] + theme["h"] * (width - 2) + theme["br"]
|
|
13
|
+
|
|
14
|
+
import textwrap
|
|
15
|
+
lines = textwrap.wrap(text, width - 4)
|
|
16
|
+
|
|
17
|
+
print(colorize(top, color))
|
|
18
|
+
for line in lines:
|
|
19
|
+
content = line.ljust(width - 4)
|
|
20
|
+
print(colorize(f"{theme['v']} {content} {theme['v']}", color))
|
|
21
|
+
print(colorize(bottom, color))
|
termcraft/colors.py
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
import colorama
|
|
3
|
+
from colorama import Fore, Back, Style
|
|
4
|
+
|
|
5
|
+
# Initialize colorama for Windows support
|
|
6
|
+
colorama.init(autoreset=True)
|
|
7
|
+
|
|
8
|
+
# Force UTF-8 encoding on Windows to prevent UnicodeEncodeError
|
|
9
|
+
if sys.stdout.encoding.lower() != "utf-8" and hasattr(sys.stdout, "reconfigure"):
|
|
10
|
+
sys.stdout.reconfigure(encoding="utf-8")
|
|
11
|
+
|
|
12
|
+
class Colors:
|
|
13
|
+
RESET = Style.RESET_ALL
|
|
14
|
+
BOLD = Style.BRIGHT
|
|
15
|
+
DIM = Style.DIM
|
|
16
|
+
NORMAL = Style.NORMAL
|
|
17
|
+
|
|
18
|
+
BLACK = Fore.BLACK
|
|
19
|
+
RED = Fore.RED
|
|
20
|
+
GREEN = Fore.GREEN
|
|
21
|
+
YELLOW = Fore.YELLOW
|
|
22
|
+
BLUE = Fore.BLUE
|
|
23
|
+
MAGENTA = Fore.MAGENTA
|
|
24
|
+
CYAN = Fore.CYAN
|
|
25
|
+
WHITE = Fore.WHITE
|
|
26
|
+
|
|
27
|
+
BG_BLACK = Back.BLACK
|
|
28
|
+
BG_RED = Back.RED
|
|
29
|
+
BG_GREEN = Back.GREEN
|
|
30
|
+
BG_YELLOW = Back.YELLOW
|
|
31
|
+
BG_BLUE = Back.BLUE
|
|
32
|
+
BG_MAGENTA = Back.MAGENTA
|
|
33
|
+
BG_CYAN = Back.CYAN
|
|
34
|
+
BG_WHITE = Back.WHITE
|
|
35
|
+
|
|
36
|
+
def colorize(text: str, color: str = "", bg: str = "", bold: bool = False) -> str:
|
|
37
|
+
res = ""
|
|
38
|
+
if color: res += getattr(Colors, color.upper(), "")
|
|
39
|
+
if bg: res += getattr(Colors, f"BG_{bg.upper()}", "")
|
|
40
|
+
if bold: res += Colors.BOLD
|
|
41
|
+
return f"{res}{text}{Colors.RESET}"
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from .emoji import emoji
|
|
2
|
+
from .status import success_emoji, error_emoji, loading_emoji, build_emoji, deploy_emoji
|
|
3
|
+
from .banner import emoji_banner
|
|
4
|
+
from .loader import emoji_spinner
|
|
5
|
+
from .weather import sun, rain, cloud, snow
|
|
6
|
+
from .react import thumbs_up, fire, clap, idea
|
|
7
|
+
from .sets import tech, education, finance, ai
|
|
8
|
+
|
|
9
|
+
__all__ = [
|
|
10
|
+
"emoji",
|
|
11
|
+
"success_emoji", "error_emoji", "loading_emoji", "build_emoji", "deploy_emoji",
|
|
12
|
+
"emoji_banner",
|
|
13
|
+
"emoji_spinner",
|
|
14
|
+
"sun", "rain", "cloud", "snow",
|
|
15
|
+
"thumbs_up", "fire", "clap", "idea",
|
|
16
|
+
"tech", "education", "finance", "ai"
|
|
17
|
+
]
|
termcraft/emoji/emoji.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
EMOJIS = {
|
|
2
|
+
"rocket": "🚀",
|
|
3
|
+
"check": "✅",
|
|
4
|
+
"warning": "⚠️",
|
|
5
|
+
"error": "❌",
|
|
6
|
+
"info": "ℹ️",
|
|
7
|
+
"fire": "🔥",
|
|
8
|
+
"clap": "👏",
|
|
9
|
+
"idea": "💡",
|
|
10
|
+
"thumbs_up": "👍",
|
|
11
|
+
"sun": "☀️",
|
|
12
|
+
"rain": "🌧️",
|
|
13
|
+
"cloud": "☁️",
|
|
14
|
+
"snow": "❄️",
|
|
15
|
+
"gear": "⚙️",
|
|
16
|
+
"computer": "💻",
|
|
17
|
+
"book": "📚",
|
|
18
|
+
"money": "💰",
|
|
19
|
+
"robot": "🤖",
|
|
20
|
+
"brain": "🧠"
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
def emoji(name: str, fallback: str = "") -> str:
|
|
24
|
+
return EMOJIS.get(name, fallback or name)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
import time
|
|
3
|
+
from ..colors import colorize
|
|
4
|
+
|
|
5
|
+
def emoji_spinner(text: str = "Loading...", duration: int = 3):
|
|
6
|
+
emojis = ["🕛", "🕐", "🕑", "🕒", "🕓", "🕔", "🕕", "🕖", "🕗", "🕘", "🕙", "🕚"]
|
|
7
|
+
end_time = time.time() + duration
|
|
8
|
+
i = 0
|
|
9
|
+
while time.time() < end_time:
|
|
10
|
+
sys.stdout.write(f"\r{emojis[i]} {text}")
|
|
11
|
+
sys.stdout.flush()
|
|
12
|
+
time.sleep(0.1)
|
|
13
|
+
i = (i + 1) % len(emojis)
|
|
14
|
+
sys.stdout.write(f"\r{colorize('✅', 'green')} {text} (Done) \n")
|
termcraft/emoji/react.py
ADDED
termcraft/emoji/sets.py
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from .emoji import emoji
|
|
2
|
+
|
|
3
|
+
def tech() -> list:
|
|
4
|
+
return [emoji("computer"), emoji("gear"), emoji("rocket")]
|
|
5
|
+
|
|
6
|
+
def education() -> list:
|
|
7
|
+
return [emoji("book"), emoji("idea"), emoji("brain")]
|
|
8
|
+
|
|
9
|
+
def finance() -> list:
|
|
10
|
+
return [emoji("money"), "📈", "🏦"]
|
|
11
|
+
|
|
12
|
+
def ai() -> list:
|
|
13
|
+
return [emoji("robot"), emoji("brain"), emoji("rocket")]
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
from .emoji import emoji
|
|
2
|
+
|
|
3
|
+
def success_emoji() -> str: return emoji("check")
|
|
4
|
+
def error_emoji() -> str: return emoji("error")
|
|
5
|
+
def loading_emoji() -> str: return "⏳"
|
|
6
|
+
def build_emoji() -> str: return emoji("gear")
|
|
7
|
+
def deploy_emoji() -> str: return emoji("rocket")
|
termcraft/icons.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
ICONS = {
|
|
2
|
+
"check": "✔",
|
|
3
|
+
"cross": "✖",
|
|
4
|
+
"warning": "⚠",
|
|
5
|
+
"info": "ℹ",
|
|
6
|
+
"arrow_right": "➔",
|
|
7
|
+
"star": "★",
|
|
8
|
+
"heart": "♥",
|
|
9
|
+
"bullet": "•",
|
|
10
|
+
"square": "■",
|
|
11
|
+
"triangle_right": "▶",
|
|
12
|
+
"triangle_down": "▼"
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
def icon(name: str) -> str:
|
|
16
|
+
return ICONS.get(name, "?")
|
termcraft/jsonview.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import json
|
|
2
|
+
from .colors import colorize
|
|
3
|
+
|
|
4
|
+
def json_view(data: dict, indent: int = 2):
|
|
5
|
+
formatted = json.dumps(data, indent=indent)
|
|
6
|
+
|
|
7
|
+
lines = formatted.split("\n")
|
|
8
|
+
for i, line in enumerate(lines):
|
|
9
|
+
if ":" in line:
|
|
10
|
+
parts = line.split(":", 1)
|
|
11
|
+
key = parts[0]
|
|
12
|
+
val = parts[1]
|
|
13
|
+
key = colorize(key, "cyan", bold=True)
|
|
14
|
+
if '"' in val:
|
|
15
|
+
val = colorize(val, "green")
|
|
16
|
+
elif any(c.isdigit() for c in val) and not ("true" in val or "false" in val or "null" in val):
|
|
17
|
+
val = colorize(val, "blue")
|
|
18
|
+
lines[i] = f"{key}:{val}"
|
|
19
|
+
|
|
20
|
+
print("\n".join(lines))
|
termcraft/lists.py
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
from .colors import colorize
|
|
2
|
+
|
|
3
|
+
def bullet(items: list, color: str = "cyan", bullet_char: str = "•"):
|
|
4
|
+
for item in items:
|
|
5
|
+
print(f"{colorize(bullet_char, color)} {item}")
|
|
6
|
+
|
|
7
|
+
def numbered(items: list, color: str = "cyan"):
|
|
8
|
+
for i, item in enumerate(items, 1):
|
|
9
|
+
print(f"{colorize(str(i) + '.', color)} {item}")
|
termcraft/progress.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
import time
|
|
3
|
+
from .colors import colorize
|
|
4
|
+
|
|
5
|
+
def progress(percent: int, length: int = 40, color: str = "cyan", text: str = "Progress"):
|
|
6
|
+
percent = max(0, min(100, percent))
|
|
7
|
+
filled_len = int(length * percent // 100)
|
|
8
|
+
bar = "█" * filled_len + "░" * (length - filled_len)
|
|
9
|
+
|
|
10
|
+
sys.stdout.write(f"\r{text} |{colorize(bar, color)}| {percent}% Complete")
|
|
11
|
+
sys.stdout.flush()
|
|
12
|
+
if percent == 100:
|
|
13
|
+
print()
|
|
14
|
+
|
|
15
|
+
def spinner(text: str = "Loading...", duration: int = 3, color: str = "cyan"):
|
|
16
|
+
chars = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"]
|
|
17
|
+
end_time = time.time() + duration
|
|
18
|
+
i = 0
|
|
19
|
+
while time.time() < end_time:
|
|
20
|
+
sys.stdout.write(f"\r{colorize(chars[i], color)} {text}")
|
|
21
|
+
sys.stdout.flush()
|
|
22
|
+
time.sleep(0.1)
|
|
23
|
+
i = (i + 1) % len(chars)
|
|
24
|
+
sys.stdout.write(f"\r{colorize('✔', 'green')} {text} (Done) \n")
|
termcraft/styles.py
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
THEMES = {
|
|
2
|
+
"ascii": {
|
|
3
|
+
"tl": "+", "tr": "+", "bl": "+", "br": "+",
|
|
4
|
+
"h": "-", "v": "|", "t_down": "+", "t_up": "+", "t_right": "+", "t_left": "+", "cross": "+"
|
|
5
|
+
},
|
|
6
|
+
"minimal": {
|
|
7
|
+
"tl": "┌", "tr": "┐", "bl": "└", "br": "┘",
|
|
8
|
+
"h": "─", "v": "│", "t_down": "┬", "t_up": "┴", "t_right": "├", "t_left": "┤", "cross": "┼"
|
|
9
|
+
},
|
|
10
|
+
"unicode": {
|
|
11
|
+
"tl": "╭", "tr": "╮", "bl": "╰", "br": "╯",
|
|
12
|
+
"h": "─", "v": "│", "t_down": "┬", "t_up": "┴", "t_right": "├", "t_left": "┤", "cross": "┼"
|
|
13
|
+
},
|
|
14
|
+
"double": {
|
|
15
|
+
"tl": "╔", "tr": "╗", "bl": "╚", "br": "╝",
|
|
16
|
+
"h": "═", "v": "║", "t_down": "╦", "t_up": "╩", "t_right": "╠", "t_left": "╣", "cross": "╬"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
ACTIVE_THEME = "unicode"
|
|
21
|
+
|
|
22
|
+
def set_theme(theme_name: str):
|
|
23
|
+
global ACTIVE_THEME
|
|
24
|
+
if theme_name in THEMES:
|
|
25
|
+
ACTIVE_THEME = theme_name
|
|
26
|
+
else:
|
|
27
|
+
raise ValueError(f"Theme '{theme_name}' not found. Available themes: {', '.join(THEMES.keys())}")
|
|
28
|
+
|
|
29
|
+
def get_theme() -> dict:
|
|
30
|
+
return THEMES[ACTIVE_THEME]
|
termcraft/tables.py
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
from .styles import get_theme
|
|
2
|
+
from .colors import colorize
|
|
3
|
+
|
|
4
|
+
def dict_ui(data: dict, title: str = "", color: str = "cyan", key_color: str = "white", val_color: str = "yellow"):
|
|
5
|
+
theme = get_theme()
|
|
6
|
+
if not data:
|
|
7
|
+
return
|
|
8
|
+
|
|
9
|
+
max_key_len = max(len(str(k)) for k in data.keys())
|
|
10
|
+
max_val_len = max(len(str(v)) for v in data.values())
|
|
11
|
+
|
|
12
|
+
width = max_key_len + max_val_len + 7
|
|
13
|
+
if title:
|
|
14
|
+
width = max(width, len(title) + 6)
|
|
15
|
+
|
|
16
|
+
top = theme["tl"] + theme["h"] * (width - 2) + theme["tr"]
|
|
17
|
+
if title:
|
|
18
|
+
title_str = f" {title} "
|
|
19
|
+
top = theme["tl"] + theme["h"] + title_str + theme["h"] * (width - 3 - len(title_str)) + theme["tr"]
|
|
20
|
+
|
|
21
|
+
bottom = theme["bl"] + theme["h"] * (width - 2) + theme["br"]
|
|
22
|
+
|
|
23
|
+
print(colorize(top, color))
|
|
24
|
+
for k, v in data.items():
|
|
25
|
+
k_str = str(k).ljust(max_key_len)
|
|
26
|
+
v_str = str(v).ljust(max_val_len)
|
|
27
|
+
# Construct border with main color, content with respective colors
|
|
28
|
+
line_start = colorize(f"{theme['v']} ", color)
|
|
29
|
+
line_mid = f"{colorize(k_str, key_color)} : {colorize(v_str, val_color)}"
|
|
30
|
+
line_end = colorize(f" {theme['v']}", color)
|
|
31
|
+
print(line_start + line_mid + line_end)
|
|
32
|
+
print(colorize(bottom, color))
|
|
33
|
+
|
|
34
|
+
def table(headers: list, rows: list, color: str = "cyan"):
|
|
35
|
+
theme = get_theme()
|
|
36
|
+
|
|
37
|
+
col_widths = [len(str(h)) for h in headers]
|
|
38
|
+
for row in rows:
|
|
39
|
+
for i, val in enumerate(row):
|
|
40
|
+
if i < len(col_widths):
|
|
41
|
+
col_widths[i] = max(col_widths[i], len(str(val)))
|
|
42
|
+
else:
|
|
43
|
+
col_widths.append(len(str(val)))
|
|
44
|
+
|
|
45
|
+
def make_separator(left, middle, right):
|
|
46
|
+
parts = [theme["h"] * (w + 2) for w in col_widths]
|
|
47
|
+
return left + middle.join(parts) + right
|
|
48
|
+
|
|
49
|
+
top = make_separator(theme["tl"], theme["t_down"], theme["tr"])
|
|
50
|
+
mid = make_separator(theme["t_right"], theme["cross"], theme["t_left"])
|
|
51
|
+
bot = make_separator(theme["bl"], theme["t_up"], theme["br"])
|
|
52
|
+
|
|
53
|
+
def print_row(data, is_header=False):
|
|
54
|
+
parts = []
|
|
55
|
+
for i, val in enumerate(data):
|
|
56
|
+
width = col_widths[i] if i < len(col_widths) else len(str(val))
|
|
57
|
+
content = str(val).ljust(width)
|
|
58
|
+
if is_header:
|
|
59
|
+
content = colorize(content, bold=True)
|
|
60
|
+
parts.append(f" {content} ")
|
|
61
|
+
|
|
62
|
+
v_bar = colorize(theme["v"], color)
|
|
63
|
+
print(v_bar + v_bar.join(parts) + v_bar)
|
|
64
|
+
|
|
65
|
+
print(colorize(top, color))
|
|
66
|
+
print_row(headers, True)
|
|
67
|
+
print(colorize(mid, color))
|
|
68
|
+
for row in rows:
|
|
69
|
+
print_row(row)
|
|
70
|
+
print(colorize(bot, color))
|
termcraft/trees.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from .colors import colorize
|
|
2
|
+
|
|
3
|
+
def tree(data: dict, prefix: str = ""):
|
|
4
|
+
"""
|
|
5
|
+
Recursively renders a dictionary as a tree.
|
|
6
|
+
"""
|
|
7
|
+
keys = list(data.keys())
|
|
8
|
+
for i, key in enumerate(keys):
|
|
9
|
+
is_last = (i == len(keys) - 1)
|
|
10
|
+
connector = "└── " if is_last else "├── "
|
|
11
|
+
|
|
12
|
+
value = data[key]
|
|
13
|
+
if isinstance(value, dict):
|
|
14
|
+
print(f"{prefix}{colorize(connector, 'cyan')}{colorize(str(key), 'blue', bold=True)}")
|
|
15
|
+
extension = " " if is_last else "│ "
|
|
16
|
+
tree(value, prefix + colorize(extension, 'cyan'))
|
|
17
|
+
else:
|
|
18
|
+
print(f"{prefix}{colorize(connector, 'cyan')}{key}: {value}")
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: termcraft
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A lightweight Python library for creating beautiful, consistent terminal output for CLI applications.
|
|
5
|
+
Home-page: https://github.com/yourusername/termcraft
|
|
6
|
+
Author: Engr. Aamir Jamil
|
|
7
|
+
Author-email: author@example.com
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Environment :: Console
|
|
15
|
+
Requires-Python: >=3.10
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
Requires-Dist: colorama>=0.4.6
|
|
18
|
+
Dynamic: author
|
|
19
|
+
Dynamic: author-email
|
|
20
|
+
Dynamic: classifier
|
|
21
|
+
Dynamic: description
|
|
22
|
+
Dynamic: description-content-type
|
|
23
|
+
Dynamic: home-page
|
|
24
|
+
Dynamic: requires-dist
|
|
25
|
+
Dynamic: requires-python
|
|
26
|
+
Dynamic: summary
|
|
27
|
+
|
|
28
|
+
# TermCraft
|
|
29
|
+
|
|
30
|
+
**TermCraft** is a lightweight Python library designed to craft beautiful, professional, and consistent terminal user interfaces for CLI applications.
|
|
31
|
+
|
|
32
|
+
*Created by **Engr. Aamir Jamil**.*
|
|
33
|
+
|
|
34
|
+
## Features
|
|
35
|
+
- **Colors & Styles:** Easily apply ANSI colors and styles, completely cross-platform.
|
|
36
|
+
- **Banners & Boxes:** Draw beautiful headers, message boxes, and separators.
|
|
37
|
+
- **Tables & Lists:** Format dictionaries and list data dynamically.
|
|
38
|
+
- **Emoji System:** Extensive built-in emoji lookup, presets, and spinners.
|
|
39
|
+
- **Progress:** Progress bars and animated loaders.
|
|
40
|
+
|
|
41
|
+
## Installation
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
pip install termcraft
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Quick Start
|
|
48
|
+
|
|
49
|
+
```python
|
|
50
|
+
from termcraft import *
|
|
51
|
+
|
|
52
|
+
title("My AI Project")
|
|
53
|
+
success("Model Trained Successfully")
|
|
54
|
+
dict_ui({"Accuracy": "98%", "Loss": "0.02"})
|
|
55
|
+
progress(75)
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Requirements
|
|
59
|
+
- Python 3.10+
|
|
60
|
+
- `colorama` (installed automatically)
|
|
61
|
+
|
|
62
|
+
## License
|
|
63
|
+
MIT License
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
termcraft/__init__.py,sha256=k3FWBRPopAHmo8RaGDYRHdyq-oAXZiOQW_JZGYLIX7k,681
|
|
2
|
+
termcraft/banners.py,sha256=XW7epiT_vjr452Z5847GHjJllhtO5n_WVrqKgUWoGic,999
|
|
3
|
+
termcraft/borders.py,sha256=s5bIPyZOq-h6_Hcnf_Q4bkOyPqu-5s4uVXH2me75Ozo,450
|
|
4
|
+
termcraft/boxes.py,sha256=aMZc2qGrvL32p8RE4rbTFA9QPqu4nBXJimoCTodRQ7k,774
|
|
5
|
+
termcraft/colors.py,sha256=yqkhBJgTRuMKmdqWC5JNpHeHGAySeZ-16XGvJv7roaI,1121
|
|
6
|
+
termcraft/icons.py,sha256=07QczqNVg1lagIxRQpuiYLQHsFzkdJcjVmTB67fNb0A,317
|
|
7
|
+
termcraft/jsonview.py,sha256=InbpIILCqpGjhc8mOwQr3ZIAIuytcEvg6kxYgZX7bkQ,672
|
|
8
|
+
termcraft/lists.py,sha256=oMHOhPZYkpfzVKkIo35HqiRX-GTMQZciagHgKWOLsUw,327
|
|
9
|
+
termcraft/progress.py,sha256=dy18vzHox5l6pfJJrvGKvE5bNqBEUzHya0JrMNfklww,903
|
|
10
|
+
termcraft/styles.py,sha256=1GeEdvtXFAIMSSR9Ww5Qg5SdgfAtiPxo0s2V1SCJZ60,1099
|
|
11
|
+
termcraft/tables.py,sha256=Q46df6pnTeR9ldF_xSzdzWFCUiUm18Jh0Wb52IjTlVo,2638
|
|
12
|
+
termcraft/trees.py,sha256=XQFReIfgHEjJLVvs-iN-Qrcv9rx6DZMkm2B7j_Jx1vs,675
|
|
13
|
+
termcraft/emoji/__init__.py,sha256=VlTiHYZ2z0d0xrzMwCSF9zKj1wyniiR2kOxrCoYo0zY,590
|
|
14
|
+
termcraft/emoji/banner.py,sha256=oB-8jhR_9aAPae-TrC9T9IuwgBQB2WNYM19RMLJIbi4,254
|
|
15
|
+
termcraft/emoji/emoji.py,sha256=WWI-jLo0kNbIiO-XAcg7-HEuRx7IuGFf4z9ZxFAXZBk,520
|
|
16
|
+
termcraft/emoji/loader.py,sha256=wx3lcD-SBXz9ZLx4F-QYWKCkCNh_ioy6We1jifPtSu4,516
|
|
17
|
+
termcraft/emoji/react.py,sha256=tG7tt9dgvJ85USy4FEj6WWIUFNxozlNa_5x785C_Ljk,196
|
|
18
|
+
termcraft/emoji/sets.py,sha256=rDVag5uaQOLnf9mzAvoko3nZZQq0C-jKRAdxpQF7-C0,341
|
|
19
|
+
termcraft/emoji/status.py,sha256=k00ff43tAPaLsJUWHx-OLtAZXSR4CL_TgnW2Z9SRg10,262
|
|
20
|
+
termcraft/emoji/weather.py,sha256=Igpu7W2fZpCM5I2szjh-rjEC5p2XdIKuAGWuajFtoV8,186
|
|
21
|
+
termcraft-0.1.0.dist-info/METADATA,sha256=6kZtmYocUBAlYB4kPvslPA7F4fsDdh8GzySnB4KyoGI,1864
|
|
22
|
+
termcraft-0.1.0.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
|
|
23
|
+
termcraft-0.1.0.dist-info/top_level.txt,sha256=DplsfqdCzmEzGDmB1vINrrvca7jNmjhLVUQc8EXtmqc,10
|
|
24
|
+
termcraft-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
termcraft
|