Compare commits
3 Commits
34460c6f4d
...
5ad8fc0dc8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5ad8fc0dc8 | ||
|
|
12df61c524 | ||
|
|
f2d5c1324a |
@@ -71,7 +71,7 @@ class User:
|
|||||||
"""Writes the input line into it's respective list,
|
"""Writes the input line into it's respective list,
|
||||||
depending on what website it belongs to."""
|
depending on what website it belongs to."""
|
||||||
|
|
||||||
if re.search("x", line):
|
if re.search(r"(x\\.com|twitter\\.com)", line):
|
||||||
self.append_list("main", validate_x_link(line))
|
self.append_list("main", validate_x_link(line))
|
||||||
elif re.search(r"kemono\.party", line):
|
elif re.search(r"kemono\.party", line):
|
||||||
self.append_list("kemono", line)
|
self.append_list("kemono", line)
|
||||||
|
|||||||
@@ -128,7 +128,16 @@ def print_webcomics(webcomics: Dict[str, Dict]) -> int:
|
|||||||
for index, entry in enumerate(webcomics["webcomics"]):
|
for index, entry in enumerate(webcomics["webcomics"]):
|
||||||
print(list_lines(index, entry["name"]))
|
print(list_lines(index, entry["name"]))
|
||||||
|
|
||||||
return int(input("Select a webcomic: "))
|
max_index = len(webcomics["webcomics"]) - 1
|
||||||
|
while True:
|
||||||
|
raw = input("Select a webcomic: ").strip()
|
||||||
|
if not raw.isdigit():
|
||||||
|
print("Please enter a number.")
|
||||||
|
continue
|
||||||
|
choice = int(raw)
|
||||||
|
if 0 <= choice <= max_index:
|
||||||
|
return choice
|
||||||
|
print(f"Please enter a number between 0 and {max_index}.")
|
||||||
|
|
||||||
|
|
||||||
def webcomic_manager():
|
def webcomic_manager():
|
||||||
|
|||||||
@@ -60,7 +60,12 @@ def clean_cache(directory: Path):
|
|||||||
shutil.rmtree(directory)
|
shutil.rmtree(directory)
|
||||||
|
|
||||||
|
|
||||||
def run(command: str | Sequence[str], verbose: bool, cwd: Path | None = None) -> None:
|
def run(
|
||||||
|
command: str | Sequence[str],
|
||||||
|
verbose: bool,
|
||||||
|
cwd: Path | None = None,
|
||||||
|
check: bool = False,
|
||||||
|
) -> None:
|
||||||
"""Run command in a subprocess"""
|
"""Run command in a subprocess"""
|
||||||
# pylint: disable=subprocess-run-check
|
# pylint: disable=subprocess-run-check
|
||||||
# This toggle allows for a really wasy debug when using -v
|
# This toggle allows for a really wasy debug when using -v
|
||||||
@@ -77,7 +82,9 @@ def run(command: str | Sequence[str], verbose: bool, cwd: Path | None = None) ->
|
|||||||
else:
|
else:
|
||||||
args = list(command)
|
args = list(command)
|
||||||
|
|
||||||
subprocess.run(args, check=False, cwd=cwd)
|
result = subprocess.run(args, check=check, cwd=cwd)
|
||||||
|
if not check and result.returncode != 0:
|
||||||
|
LOG.warning("Command failed (%s): %s", result.returncode, args)
|
||||||
|
|
||||||
|
|
||||||
def list_lines(i: int, line: str) -> str:
|
def list_lines(i: int, line: str) -> str:
|
||||||
|
|||||||
Reference in New Issue
Block a user