Commit Graph

7109 Commits

Author SHA1 Message Date
Azalea
a7b1eb6b83 Merge pull request #1 from TheoHaines/patch-1 2026-07-12 04:40:13 +00:00
Theo Haines
c518b86a35
Enhance to_ansi method with mode validation
Add error handling for unsupported color modes in to_ansi method.
2026-07-03 01:53:45 +01:00
Flaykky
720e62815a [+] Improve shell completion: substring matching + descriptions
Previously the three dynamic completion functions in cli_options.rs
(complete_preset, complete_mode, complete_backend) only returned
candidates whose names *started with* the typed prefix, and returned
no hint text alongside each candidate.

This meant that, for example, typing `hyfetch -p trans<TAB>` found
`transgender` but typing `hyfetch -p gender<TAB>` found nothing, even
though `gender` uniquely identifies `transgender`. The interactive flag
picker (used during `hyfetch --config`) already performs substring
matching; the shell completion was inconsistent with it.

Changes:
- Extracted a shared `ranked_completions()` helper that drives all
  three functions. It uses `str::contains` instead of `str::starts_with`
  so any substring of a candidate name triggers a match.
- Results are sorted so that prefix matches appear before other
  substring matches, then by position of the match within the name,
  then alphabetically — identical ordering to the interactive picker's
  `filter_flag_indices`.
- Each completion entry now carries a short human-readable description
  ("pride flag preset", "color mode", "fetch backend") surfaced by
  shells that display hints next to candidates (e.g. zsh with
  `complete_help`, fish).
- Added three unit tests under `#[cfg(feature = "autocomplete")]`:
    complete_preset_substring   – "gender" matches "transgender"
    complete_preset_prefix_ranked_first – "trans" puts prefix match first
    complete_preset_descriptions        – every result has a non-empty hint
  All five tests (including the pre-existing check_options and
  models::test) pass with `cargo test -p hyfetch --features autocomplete`.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-07 00:34:48 +03:00
Flaykky
1aaa42be84 [F] Fix multiple crash bugs in the Python fallback
termenv.py:
- unix_detect_ansi_mode: `TERM`/`COLORTERM` can be absent from the
  environment (CI, cron, some IDEs). `os.environ.get('TERM')` returns
  None in that case, so subsequent `term.startswith(...)` and
  `'256color' in term` calls raised AttributeError. Changed to
  `os.environ.get('TERM') or ''` for both variables.
- unix_read_osc: same None dereference on line 99 (`term.startswith`).
  Applied the same `or ''` guard.
- unix_read_osc: `code.lstrip(start)` was used to strip the OSC prefix,
  but `str.lstrip` strips individual *characters*, not a prefix string,
  so it could silently over-consume leading bytes of the actual payload.
  Replaced with an explicit `code[len(start):]` slice after a
  `startswith` check.
- windows_detect_ansi_mode: `map(int, platform.version().split('.'))`
  crashes with ValueError/TypeError on non-standard version strings.
  Wrapped in try/except with a safe fallback of `'rgb'`.
  `int(os.environ.get('ANSICON_VER'))` raised when the var was unset or
  non-numeric; guarded with `.isdigit()` before converting.

color_util.py:
- RGB.to_ansi: for `mode == 'ansi'` it forwarded to `to_ansi_16` which
  is an unimplemented stub (`raise NotImplementedError`). For
  `mode == 'default'` and any other unknown mode the function fell
  through and returned None, causing TypeError when callers concatenated
  the result into strings (e.g. in presets.py). Both cases now fall back
  to `to_ansi_8bit`, which is a correct and safe 256-color degradation.
  Return type annotation updated to `str`.

neofetch_util.py:
- ensure_git_bash: `git_path` returned by the `if_file(...)` chain can
  be None when no Git Bash installation is found on Windows. The
  subsequent `git_path.is_file()` then raised AttributeError instead of
  printing the friendly error message. Fixed to `if not git_path or not
  git_path.is_file():`.
- get_distro_ascii: `run_neofetch_cmd` can return None when neofetch is
  missing or exits non-zero without raising. The following `.replace()`
  call would then crash with AttributeError. Added an explicit None
  guard that prints an error and exits cleanly.
- run(): the backend dispatcher had no else/fallback branch, so an
  unknown or mistyped backend silently returned None and produced no
  output. Added `raise ValueError(f"Unknown backend: {backend!r}")`.

types.py:
- BackendLiteral was `Literal["neofetch", "fastfetch"]`, missing
  `"qwqfetch"` and `"fastfetch-old"` which are both accepted by the
  argparse parser and the run() dispatcher. Stale types caused false
  type-checker warnings for valid inputs. Updated to include all four
  supported backends.

main.py:
- select_lightness: the prompt advertises `.45` and `0.45` as valid
  decimal inputs, but the parser called `int(lightness)` first, which
  raises ValueError for any non-integer float, landing in the error
  path before the `float()` branch was ever reached. Reordered to:
  handle `%` suffix first, then `float()` for everything else, dividing
  by 100 only when the value exceeds 1.
- June/pride-month check: `os.isatty(sys.stdout.fileno())` raises
  io.UnsupportedOperation when stdout is piped or replaced (e.g. during
  testing or when output is redirected). Replaced with the pattern
  already used in termenv.py: `hasattr(sys.stdout, 'isatty') and
  sys.stdout.isatty()`.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-07 00:34:04 +03:00
David Marzal
8840ac7c76
Make Default declaration match variable on neofecth (#516)
Some checks failed
Shellcheck / check (push) Has been cancelled
Shouldn't the # Default: line match the variable assignation?

If yes, this PR fix the mismatch I found.

Thanks!
2026-06-04 01:01:33 +08:00
Azalea
98b3592190 [U] Upgrade action
Some checks are pending
Shellcheck / check (push) Waiting to run
2026-06-03 07:57:36 +00:00
Azalea
7c57f66678 [F] Fix release recovery workflow 2026-06-03 07:48:53 +00:00
Azalea
0fd343e6d5 [+] Release workflow 2026-06-03 07:19:37 +00:00
Azalea
6b6406e2db [O] Changelog 2026-06-03 06:32:41 +00:00
Azalea
8c55462d83 [+] Changelog 2026-06-03 06:21:22 +00:00
Azalea
dfa6ace803 [-] Remove unused files 2026-06-03 06:11:38 +00:00
Azalea
5f42c8f46f
[-] Remove irrelevant file 2026-06-03 14:01:00 +08:00
Azalea
83b1a1fc32 [F] Fix CPU identification on PRoot-Distro on Android (Closes #355) 2026-06-03 05:40:46 +00:00
Azalea
8f87af0751 [O] Report memory used instead of memory unavailable (Closes #117) 2026-06-03 05:27:54 +00:00
Azalea
2cfba26180 [+] Tuxedo Linux, enbian flag (Closes #333) 2026-06-03 05:19:17 +00:00
Azalea
019d845da5 [F] neofetch: skip inactive DRM connectors for resolution (Fix #319) 2026-06-03 05:16:00 +00:00
Azalea
1f85002da5 [+] glxinfo for gpu info (Fix #225) 2026-06-03 04:56:59 +00:00
Azalea
9c280bf1cf [+] neofetch: Add steam library detection (Fix #346) 2026-06-03 04:56:16 +00:00
Azalea
94db3d56fb [F] Make android fall back to lscpu (Fix #120) 2026-06-03 04:53:47 +00:00
Azalea
8298079baa [F] Fix macOS issues (Fix #40) 2026-06-03 04:50:22 +00:00
Azalea
d248e768ea [F] Fix intel OEM iGPU name (Fix #230) 2026-06-03 04:45:51 +00:00
Azalea
209e2ec315 [O] Add pipx & uv to readme instructions (Fix #193) 2026-06-03 04:33:12 +00:00
Azalea
6618c7ab5e [+] CPU Codenames (Fix #381) 2026-06-03 04:23:26 +00:00
Azalea
51560d1d76 [F] Fix #306 2026-06-03 04:17:37 +00:00
Azalea
95d7f1d1ea [F] Fix #327 2026-06-03 03:51:26 +00:00
Azalea
e033038152 [+] low sixel image output for terminals that doesn't support -I (Fix #404) 2026-06-03 03:45:52 +00:00
Azalea
c36d349273 [+] FiwixOS (Fix #356) 2026-06-03 03:39:06 +00:00
Azalea
e50fa4040e [+] Imaginary Linux (Fix #390) 2026-06-03 00:59:20 +00:00
Azalea
4901b6e46d
[+] MidOS (Fix #363) (#514) 2026-06-03 08:40:17 +08:00
Azalea
820d4d458c
[+] OpenSolaris (Fix #368) (#513) 2026-06-03 08:31:26 +08:00
Azalea
06a92c0286
[F] Fix #364 (#512) 2026-06-03 08:09:47 +08:00
icedog
673a1672d3
Add demisexual flag (#511)
* Added demisexual flag

* fix demisexual hex capitalization
2026-06-03 06:01:40 +08:00
Azalea
1160be71a2 [F] Fix #496? 2026-06-02 02:19:38 +00:00
Azalea
32c9c182e6
[F] Fix #503 (#509)
[F] Fix #503?
2026-06-02 08:56:24 +08:00
Azalea
6a274ec021 [F] Fix #508 2026-06-01 22:57:51 +00:00
Azalea
e1a32ad344 [F] Fix #498
Some checks are pending
Shellcheck / check (push) Waiting to run
2026-06-01 12:34:34 +00:00
Theo Haines
beff0aa547
[+] Add paragender, paraboy, paragirl, paranonbinary, cupio flags (#506)
Some checks failed
Shellcheck / check (push) Has been cancelled
* [+] Add paragender, paraboy, paragirl & paranonbinary flags

* [+] Add Cupio flags

* [C] Updated para- flags to be more faithful to the original designs using weights

* [+] Added alt versions of para- flags as faithful versions don't render well on some distro ascii

* [F] Fix color too thin will lead to being hidden

---------

Co-authored-by: obsoletedevgit <theohaines@yahoo.com>
Co-authored-by: Azalea <noreply@aza.moe>
2026-05-30 06:05:56 +08:00
kendy.online
a10d8357e4
[PR] Add palette_glyph for macchina backend (#501)
Some checks failed
Shellcheck / check (push) Has been cancelled
* add palette_glyph for macchina backend

* new palette enum to accomodate different palette types

* fixed some errors

* whoops

* [F] Fix building without cfg macchina

* [+] Useful characters

* [O] Shorten

---------

Co-authored-by: Azalea <noreply@aza.moe>
2026-05-27 18:59:58 -04:00
Rock Pie
44a0c28853
fix neowofetch hardware detection on Interix if %WINDIR% isn't C:\Windows (#507)
* fix neowofetch failing to fetch system specs on Interix with a non-standard %WINDIR%

* fix memory being divided by 1024 too many times on Interix by neowofetch

* [F] Fix shell quoting

---------

Co-authored-by: Azalea <noreply@aza.moe>
2026-05-28 01:25:31 +08:00
Azalea
1890bb8f03
[F] Fix ascii from file for neofetch (#505)
Some checks failed
Shellcheck / check (push) Has been cancelled
2026-05-22 08:33:42 +08:00
Azalea Gui
e64f7efca6 [F] Fix escaping (Fix #500)
Some checks failed
Shellcheck / check (push) Has been cancelled
2026-04-20 23:45:57 -04:00
Azalea Gui
7bfb750f63 [F] Fix #499: neowofetch not found
Some checks are pending
Shellcheck / check (push) Waiting to run
2026-04-20 01:43:50 -04:00
Azalea Gui
7433df5d74 [O] Dockerize AI github moderator
Some checks are pending
Shellcheck / check (push) Waiting to run
2026-04-20 01:33:44 -04:00
Azalea Gui
2361be73ba [F] Update AI github moderator usage 2026-04-20 01:33:44 -04:00
Azalea Gui
5f8a34142e [U] Release 2.1.0 2026-04-20 01:33:44 -04:00
Azalea
36c081c2ce [F] Order ascii checks
Some checks failed
Shellcheck / check (push) Has been cancelled
2026-04-12 18:53:27 +00:00
Azalea
4ee3cd6b85 [O] Remove unused 2026-04-12 18:40:57 +00:00
Azalea
5b9865382e [F] Maybe fix path escaping issue #496 2026-04-12 18:36:46 +00:00
Luna Jernberg
6241531ce9
Update Slackware installation instructions (#495)
Some checks failed
Shellcheck / check (push) Has been cancelled
Updated Slackware installation instructions to include new maintainer MDKDIO.
2026-04-12 05:53:54 +08:00
Zzyzx Wolfe
2196517709
[+] Queer Villain Pride flag. (#497)
Sourced from https://distressedegg.fun/qvp
2026-04-12 05:53:32 +08:00