loopstring 0.0.3__tar.gz → 0.0.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: loopstring
3
- Version: 0.0.3
3
+ Version: 0.0.5
4
4
  Summary: Terminal utilities
5
5
  Requires-Python: >=3.7
6
6
  Description-Content-Type: text/markdown
@@ -30,8 +30,8 @@ pip install loopstring
30
30
  ```python
31
31
  from loopstring import BOXES
32
32
 
33
- # Draw a clean rounded box around your text
34
- print(BOXES.rounded("System Online"))
33
+ # Draw a clean rounded box using the style parameter
34
+ print(BOXES.draw_box("System Online", style="rounded"))
35
35
  ```
36
36
 
37
37
  ### 2. Styling Terminal Text
@@ -23,8 +23,8 @@ pip install loopstring
23
23
  ```python
24
24
  from loopstring import BOXES
25
25
 
26
- # Draw a clean rounded box around your text
27
- print(BOXES.rounded("System Online"))
26
+ # Draw a clean rounded box using the style parameter
27
+ print(BOXES.draw_box("System Online", style="rounded"))
28
28
  ```
29
29
 
30
30
  ### 2. Styling Terminal Text
@@ -0,0 +1,3 @@
1
+ from .loopstring import FG, BG, FORMAT, BOXES, SYMBOLS
2
+
3
+ __all__ = ['FG', 'BG', 'FORMAT', 'BOXES', 'SYMBOLS']
@@ -8,7 +8,6 @@ class FG:
8
8
  MAGENTA = "\033[35m"
9
9
  CYAN = "\033[36m"
10
10
  WHITE = "\033[37m"
11
- RESET = "\033[39m"
12
11
 
13
12
  class BG:
14
13
  """Background colors"""
@@ -30,6 +29,7 @@ class FORMAT:
30
29
  UNDERLINE = '\033[4m' # Underline
31
30
  REVERSE = '\033[7m' # Reverse video
32
31
  STRIKETHROUGH = '\033[9m' # Strikethrough
32
+ RESET = "\033[39m"
33
33
 
34
34
  class BOXES:
35
35
  @staticmethod
@@ -38,42 +38,52 @@ class BOXES:
38
38
 
39
39
  Supported styles: 'light', 'heavy', 'double', 'rounded', 'dashed'
40
40
  """
41
- # Define unicode box-drawing character maps
41
+ # ... keep all your existing draw_box code exactly the same ...
42
42
  glyphs = {
43
43
  'light': {'h': '─', 'v': '│', 'tl': '┌', 'tr': '┐', 'bl': '└', 'br': '┘'},
44
44
  'heavy': {'h': '━', 'v': '┃', 'tl': '┏', 'tr': '┓', 'bl': '┗', 'br': '┛'},
45
45
  'double': {'h': '═', 'v': '║', 'tl': '╔', 'tr': '╗', 'bl': '╚', 'br': '╝'},
46
46
  'rounded': {'h': '─', 'v': '│', 'tl': '╭', 'tr': '╮', 'bl': '╰', 'br': '╯'},
47
- # Using a triple-dash pattern for the dashed style
48
47
  'dashed': {'h': '┄', 'v': '┆', 'tl': '┌', 'tr': '┐', 'bl': '└', 'br': '┘'}
49
48
  }
50
-
51
- # Fallback to light style if an invalid style is passed
52
49
  g = glyphs.get(style.lower(), glyphs['light'])
53
-
54
- # Split text into lines and find the longest line to set box width
55
50
  lines = text.split('\n')
56
51
  max_width = max(len(line) for line in lines) if lines else 0
57
-
58
- # Construct the box layers
59
52
  box = []
60
53
  box.append(f"{g['tl']}{g['h'] * (max_width + 2)}{g['tr']}")
61
-
62
54
  for line in lines:
63
55
  box.append(f"{g['v']} {line.ljust(max_width)} {g['v']}")
64
-
65
56
  box.append(f"{g['bl']}{g['h'] * (max_width + 2)}{g['br']}")
66
-
67
57
  return '\n'.join(box)
58
+
59
+ # 🚀 NEW SHORTCUTS FOR VERSION 0.0.5 🚀
60
+ @staticmethod
61
+ def rounded(text: str) -> str:
62
+ """Shortcut to draw a rounded box."""
63
+ return BOXES.draw_box(text, style='rounded')
64
+
65
+ @staticmethod
66
+ def heavy(text: str) -> str:
67
+ """Shortcut to draw a heavy box."""
68
+ return BOXES.draw_box(text, style='heavy')
69
+
70
+ @staticmethod
71
+ def double(text: str) -> str:
72
+ """Shortcut to draw a double box."""
73
+ return BOXES.draw_box(text, style='double')
74
+
75
+ @staticmethod
76
+ def dashed(text: str) -> str:
77
+ """Shortcut to draw a dashed box."""
78
+ return BOXES.draw_box(text, style='dashed')
79
+
68
80
 
69
81
  class SYMBOLS:
70
82
  """Cool symbols!"""
71
- HEXAGON = '⬢' # Bold
72
- PENTAGON = '⬟' # Dim
73
- STAR = '⭑' # Italic
74
- DOWNLOAD = '⤓' # Underline
75
- REVERSE = '\033[7m' # Reverse video
76
- STRIKETHROUGH = '\033[9m' # Strikethrough
83
+ HEXAGON = '⬢'
84
+ PENTAGON = '⬟'
85
+ STAR = '⭑'
86
+ DOWNLOAD = '⤓'
77
87
  LIGHTSHADE = '░'
78
88
  MEDIUMSHADE = '▒'
79
89
  DARKSHADE = '▓'
@@ -88,6 +98,3 @@ class SYMBOLS:
88
98
  FILLEDRIGHTTRIANGLE = '▶'
89
99
  RIGHTTRIANGLE = '▷'
90
100
  ASTROIDSTAR = '✦'
91
-
92
- print(BOXES.draw_box("lol", "heavy"))
93
- print(FORMAT.BOLD + "text")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: loopstring
3
- Version: 0.0.3
3
+ Version: 0.0.5
4
4
  Summary: Terminal utilities
5
5
  Requires-Python: >=3.7
6
6
  Description-Content-Type: text/markdown
@@ -30,8 +30,8 @@ pip install loopstring
30
30
  ```python
31
31
  from loopstring import BOXES
32
32
 
33
- # Draw a clean rounded box around your text
34
- print(BOXES.rounded("System Online"))
33
+ # Draw a clean rounded box using the style parameter
34
+ print(BOXES.draw_box("System Online", style="rounded"))
35
35
  ```
36
36
 
37
37
  ### 2. Styling Terminal Text
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "loopstring"
7
- version = "0.0.3"
7
+ version = "0.0.5"
8
8
  description = "Terminal utilities"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.7"
@@ -1,7 +0,0 @@
1
- # loopstring/__init__.py
2
-
3
- # Explicitly pull the classes from your main code file into the package front door
4
- from .loopstring import FG, BG, FORMAT, BOXES
5
-
6
- # Expose them for when people use "from loopstring import *"
7
- __all__ = ['FG', 'BG', 'FORMAT', 'BOXES']
File without changes
File without changes