rename length variable

This commit is contained in:
thePR0M3TH3AN
2025-06-21 12:16:39 -04:00
parent 0f3823403f
commit 02923befc3

View File

@@ -98,18 +98,18 @@ def open_editor(initial: str) -> str:
def _len_transform(limit: int): def _len_transform(limit: int):
def _t(val: str) -> str: def _t(val: str) -> str:
l = len(val) length = len(val)
if l > limit: if length > limit:
return f"[red]{val} ({l}/{limit})[/red]" return f"[red]{val} ({length}/{limit})[/red]"
return f"{val} ({l}/{limit})" return f"{val} ({length}/{limit})"
return _t return _t
def _len_validator(limit: int): def _len_validator(limit: int):
def _v(val: str): def _v(val: str):
l = len(val) length = len(val)
if l > limit: if length > limit:
return f"Must be at most {limit} characters ({l})" return f"Must be at most {limit} characters ({length})"
return True return True
return _v return _v
@@ -174,13 +174,13 @@ def interactive_update(config_path: str):
console.rule("Body text") console.rule("Body text")
while True: while True:
body = open_editor(data.get("content", "")) body = open_editor(data.get("content", ""))
l = len(body) length = len(body)
if l > 1000: if length > 1000:
console.print(f"Body length: {l}/1000 exceeds limit", style="red") console.print(f"Body length: {length}/1000 exceeds limit", style="red")
if not inquirer.confirm(message="Edit again?", default=True).execute(): if not inquirer.confirm(message="Edit again?", default=True).execute():
break break
else: else:
console.print(f"Body length: {l}/1000", style="green") console.print(f"Body length: {length}/1000", style="green")
break break
data["content"] = body data["content"] = body