Skip to content

Commit 0ec76cf

Browse files
committed
Replace vendored lolcat with rich for cross-platform rainbow logo
Remove the vendored lolcat.py which crashes on Windows due to unconditional SIGPIPE import and broken stdoutWin class. Replace with rich.text.Text styling since rich is already a dependency. Fixes #29 https://claude.ai/code/session_01M3wRX9tnmc4qorVWRjmqTZ
1 parent 45f232c commit 0ec76cf

File tree

2 files changed

+14
-301
lines changed

2 files changed

+14
-301
lines changed

src/ipdata/cli.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
╰───────────────╯
4747
"""
4848
import csv
49-
import io
5049
import json
5150
import logging
5251
import os
@@ -66,9 +65,8 @@
6665
from rich.progress import Progress
6766
from rich.tree import Tree
6867

69-
from .lolcat import LolCat
7068
from .geofeeds import Geofeed, GeofeedValidationError
71-
from .ipdata import DotDict, IPData
69+
from .ipdata import IPData
7270

7371
console = Console()
7472

@@ -95,19 +93,24 @@ def _lookup(ipdata, *args, **kwargs):
9593

9694
def print_ascii_logo():
9795
"""
98-
Print cool ascii logo with lolcat.
96+
Print cool ascii logo with rainbow colors.
9997
"""
100-
options = DotDict({"animate": False, "os": 6, "spread": 3.0, "freq": 0.1})
101-
logo = """
102-
_ _ _
103-
(_)_ __ __| | __ _| |_ __ _
98+
from rich.text import Text
99+
100+
logo = r"""
101+
_ _ _
102+
(_)_ __ __| | __ _| |_ __ _
104103
| | '_ \ / _` |/ _` | __/ _` |
105104
| | |_) | (_| | (_| | || (_| |
106105
|_| .__/ \__,_|\__,_|\__\__,_|
107106
|_|
108-
"""
109-
lol = LolCat()
110-
lol.cat(io.StringIO(logo), options)
107+
"""
108+
rainbow = ["red", "orange1", "yellow", "green", "blue", "dark_violet"]
109+
lines = logo.strip("\n").split("\n")
110+
for i, line in enumerate(lines):
111+
text = Text(line)
112+
text.stylize(rainbow[i % len(rainbow)])
113+
console.print(text)
111114

112115

113116
def pretty_print_data(data):

src/ipdata/lolcat.py

Lines changed: 0 additions & 290 deletions
This file was deleted.

0 commit comments

Comments
 (0)