nercone-modern 1.11.2__tar.gz → 1.11.4__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.3
2
2
  Name: nercone-modern
3
- Version: 1.11.2
3
+ Version: 1.11.4
4
4
  Summary: Modern CLI Library
5
5
  Author: Nercone
6
6
  Author-email: Nercone <nercone@diamondgotcat.net>
@@ -8,6 +8,7 @@ License: MIT
8
8
  Classifier: Programming Language :: Python :: 3
9
9
  Classifier: License :: OSI Approved :: MIT License
10
10
  Classifier: Operating System :: OS Independent
11
+ Requires-Dist: strip-ansi
11
12
  Requires-Python: >=3.6
12
13
  Project-URL: Homepage, https://github.com/DiamondGotCat/nercone-modern
13
14
  Description-Content-Type: text/markdown
@@ -4,7 +4,7 @@ build-backend = "uv_build"
4
4
 
5
5
  [project]
6
6
  name = "nercone-modern"
7
- version = "1.11.2"
7
+ version = "1.11.4"
8
8
  description = "Modern CLI Library"
9
9
  readme = { file = "README.md", content-type = "text/markdown" }
10
10
  authors = [
@@ -12,6 +12,9 @@ authors = [
12
12
  ]
13
13
  license = { text = "MIT" }
14
14
  requires-python = ">=3.6"
15
+ dependencies = [
16
+ "strip-ansi"
17
+ ]
15
18
  classifiers = [
16
19
  "Programming Language :: Python :: 3",
17
20
  "License :: OSI Approved :: MIT License",
@@ -8,6 +8,7 @@
8
8
 
9
9
  import sys
10
10
  from .color import ModernColor
11
+ from strip_ansi import strip_ansi
11
12
  from datetime import datetime, timezone
12
13
 
13
14
  ModernLoggingLevels = ["DEBUG", "INFO", "WARN", "ERROR", "CRITICAL"]
@@ -62,7 +63,7 @@ class ModernLogging:
62
63
  _last_level = normalize_level(level_text.strip().upper())
63
64
  if self.filepath:
64
65
  with open(self.filepath, "a") as f:
65
- f.write(f"{log_line}\n")
66
+ f.write(f"{strip_ansi(log_line)}\n")
66
67
 
67
68
  def prompt(self, message: str = "", level_text: str = "INFO", level_color: str | None = None, default: str | None = None, show_default: bool = False, choices: list[str] | None = None, show_choices: bool = True, interrupt_ignore: bool = False, interrupt_default: str | None = None) -> str:
68
69
  if not is_higher_priority(level_text, self.display_level):
@@ -103,7 +104,7 @@ class ModernLogging:
103
104
  self._rewrite_prompt_line_with_answer(log_line, answer)
104
105
  if self.filepath:
105
106
  with open(self.filepath, "a") as f:
106
- f.write(f"{log_line}{answer}\n")
107
+ f.write(f"{strip_ansi(log_line)}{answer}\n")
107
108
  if choices:
108
109
  selected = self._select_choice(answer, choices)
109
110
  if selected is not None:
@@ -114,7 +115,7 @@ class ModernLogging:
114
115
  print(log_line)
115
116
  if self.filepath:
116
117
  with open(self.filepath, "a") as f:
117
- f.write(f"{log_line}{answer}\n")
118
+ f.write(f"{strip_ansi(log_line)}{answer}\n")
118
119
  log_line = self.make(message=message, level_text=level_text, level_color=level_color)
119
120
  print(log_line, end="")
120
121
  try:
@@ -141,7 +142,7 @@ class ModernLogging:
141
142
  self._rewrite_prompt_line_with_answer(log_line, answer)
142
143
  if self.filepath:
143
144
  with open(self.filepath, "a") as f:
144
- f.write(f"{log_line}{answer}\n")
145
+ f.write(f"{strip_ansi(log_line)}{answer}\n")
145
146
  if answer.strip() == "" and default is not None:
146
147
  if choices:
147
148
  selected_default = self._select_choice(default, choices)