From 7bfb750f6308e059058279e5d86de700f227ac83 Mon Sep 17 00:00:00 2001 From: Azalea Gui <22280294+hykilpikonna@users.noreply.github.com> Date: Mon, 20 Apr 2026 01:43:50 -0400 Subject: [PATCH] [F] Fix #499: neowofetch not found --- hyfetch/__main__.py | 7 +++++++ hyfetch/neofetch_util.py | 11 +++++++---- pyproject.toml | 4 ++-- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/hyfetch/__main__.py b/hyfetch/__main__.py index 1f4e0064..5af96a9e 100644 --- a/hyfetch/__main__.py +++ b/hyfetch/__main__.py @@ -5,6 +5,13 @@ import os from .py import run_py from .rs import run_rust + +def run_neofetch(): + from .neofetch_util import run_neofetch_cmd + import sys + run_neofetch_cmd(sys.argv[1:]) + + if __name__ == '__main__': if os.environ.get('HYFETCH_PY', False): run_py() diff --git a/hyfetch/neofetch_util.py b/hyfetch/neofetch_util.py index f44a4cc5..872bfb12 100644 --- a/hyfetch/neofetch_util.py +++ b/hyfetch/neofetch_util.py @@ -248,19 +248,22 @@ def check_windows_cmd(): # sys.exit(0) -def run_neofetch_cmd(args: str, pipe: bool = False) -> str | None: +def run_neofetch_cmd(args: str | list[str], pipe: bool = False) -> str | None: """ Run neofetch command """ + if isinstance(args, str): + args = shlex.split(args) + if platform.system() != 'Windows': bash = ['/usr/bin/env', 'bash'] if Path('/usr/bin/env').is_file() else [shutil.which('bash')] - full_cmd = [*bash, get_command_path(), *shlex.split(args)] + full_cmd = [*bash, get_command_path(), *args] else: cmd = get_command_path().replace("\\", "/").replace("C:/", "/c/") - args = args.replace('\\', '/').replace('C:/', '/c/') + args = [a.replace('\\', '/').replace('C:/', '/c/') for a in args] - full_cmd = [ensure_git_bash(), cmd, *shlex.split(args)] + full_cmd = [ensure_git_bash(), cmd, *args] full_cmd = [str(c) for c in full_cmd] if pipe: diff --git a/pyproject.toml b/pyproject.toml index 94d7212b..ef8fc75f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -40,6 +40,7 @@ Homepage = "https://github.com/hykilpikonna/HyFetch" "hyfetch.v1" = "hyfetch.__main__:run_py" "hyfetch.rs" = "hyfetch.__main__:run_rust" "hyfetch" = "hyfetch.__main__:run_rust" +"neowofetch" = "hyfetch.__main__:run_neofetch" [tool.hatch.version] source = "regex" @@ -49,5 +50,4 @@ regex = 'version = "(?P.+?)"' [tool.hatch.build] exclude = ["/tools"] -[tool.hatch.build.targets.wheel.files] -"{py_scripts}/neowofetch" = "hyfetch/scripts/neowofetch" +