feat(config-help): add --html and --man flags; add config-update function

config-help gains two new flags:
- --html / -w: opens docs/html/index.html in the default browser using
  smart browser detection (xdg-mime https scheme handler → known binaries
  → xdg-open fallback) to avoid MIME-type mismatches with non-browser apps
- --man / -m: opens the compiled docs/fish-config.1 man page via man -l

config-update is a new function that pulls the latest fish config from the
hard-coded upstream URL without requiring a configured git remote. Suppresses
git output and reports status with colored messages. Supports --dry-run and
--force flags.

README updated to document all new commands.
This commit is contained in:
2026-06-08 15:27:47 -04:00
parent 9795164eda
commit de07040c16
4 changed files with 367 additions and 15 deletions
+17 -1
View File
@@ -328,13 +328,17 @@ A curated offline reference manual is available at `docs/fish-config.md`. It cov
|---|---|
| `help config` | Open the offline manual in the best available pager |
| `help config <keyword>` | Jump directly to a section matching the keyword |
| `config-help --html` | Open the pre-built HTML docs in the default browser |
| `config-help --man` | Open the compiled man page via `man -l` |
The viewer falls back through: **ov** (syntax highlight + section navigation) → **bat** (syntax highlight) → **man -l** (pre-compiled man page) → **less****cat**.
The pager viewer falls back through: **ov** (syntax highlight + section navigation) → **bat** (syntax highlight) → **man -l** (pre-compiled man page) → **less****cat**.
Examples: `help config keybindings` · `help config pkg` · `help config fish-deps` · `help config abbreviations`
> **Tip:** `help config` is the preferred way to access offline docs — it integrates naturally with fish's built-in `help` command. The underlying `config-help` function is still available directly if needed.
The `--html` flag opens `docs/html/index.html` in your default browser. It detects the correct browser by querying the system's `https://` scheme handler (via `xdg-mime`), falling back through known browser binaries, then `xdg-open` as a last resort. Set `$fish_help_browser` or `$BROWSER` to override.
You can also read the documentation as a standard man page — the symlink and `MANPATH` are set up automatically on shell start:
```fish
@@ -345,6 +349,18 @@ The man page is auto-generated from `docs/fish-config.md` by the CI pipeline on
> **Note:** `fish-config` (hyphen) is this configuration's man page. `fish_config` (underscore) is fish's built-in browser-based configuration tool — a completely separate command. Don't mix them up.
### Updating the Config
Pull the latest changes from the upstream repository without needing a configured git remote:
| Command | Description |
|---|---|
| `config-update` | Fetch and apply the latest commits from upstream |
| `config-update --dry-run` | Preview available changes without applying them |
| `config-update --force` | Stash local changes, pull, then restore the stash |
The remote URL (`https://git.rootiest.dev/rootiest/fish-config.git`) is hard-coded, so `config-update` works even on a fresh clone with no `origin` set. All git output is suppressed; colored status messages report what changed. After a successful pull, reload the shell with `exec fish`.
### Dependency Management
`fish-deps` is a unified command for checking, installing, and updating all tools this config depends on.