refactor: delegate -l output to findmnt
Update PKGBUILD version / update-pkgver (push) Successful in 2s
Update PKGBUILD version / update-pkgver (push) Successful in 2s
The custom one-alias-per-line output was useless — no mountpoint, no source, no options. Reinventing a table format when findmnt from util-linux already produces a familiar fuse.sshfs view was the wrong call. -l now shells out to findmnt -t fuse.sshfs.
This commit is contained in:
@@ -1,5 +1,35 @@
|
||||
# Decisions
|
||||
|
||||
## 2026-05-04 – Delegate `-l` output to `findmnt -t fuse.sshfs`
|
||||
- **Who**: Dom, ClaudeCode
|
||||
- **Why**: The custom `-l` output ("just the alias, one per line") was
|
||||
uselessly minimal — no mountpoint, no source, no options. Reinventing a
|
||||
table format for a single command was the wrong call when `findmnt` from
|
||||
`util-linux` already produces a familiar, well-formatted view of fuse.sshfs
|
||||
mounts.
|
||||
- **Tradeoffs**:
|
||||
- External dependency on `findmnt` (part of `util-linux`, present on every
|
||||
Arch and most other Linux systems by default — no real adoption cost).
|
||||
- Output is mountpoint-first, not alias-first. The alias is only visible as
|
||||
the last path segment under the SOURCE column / TARGET basename.
|
||||
- Lists *all* fuse.sshfs mounts on the system, not just sshfsc-managed
|
||||
ones under `$XDG_RUNTIME_DIR/sshfs/`. In practice this is what the user
|
||||
wants ("show me all sshfs mounts"); a future `-r` (restrict) flag could
|
||||
narrow it if needed.
|
||||
- `findmnt` exits 1 when nothing matches its filter — we treat that as
|
||||
success-with-empty-output, not a failure.
|
||||
- **How**:
|
||||
- `list_mounts` rewritten as a thin wrapper around `exec.Command("findmnt",
|
||||
"-t", "fuse.sshfs")` with stdout piped to the caller's writer.
|
||||
- Exit-code 1 from `findmnt` is swallowed via `errors.As(err, *exec.ExitError)`
|
||||
+ `ExitCode() == 1`.
|
||||
- `errors.Is(err, exec.ErrNotFound)` produces a clear "install util-linux"
|
||||
message instead of a cryptic exec error.
|
||||
- Tests `TestListMountsMissingBase` and `TestListMountsFiltersUnmounted`
|
||||
removed: they covered the old in-Go enumeration logic that no longer
|
||||
exists. Mocking `findmnt` would be alibi-testing — the wrapper is two
|
||||
branches over `cmd.Run()`'s error.
|
||||
|
||||
## 2026-05-04 – Detect mounts via `/proc/self/mountinfo` instead of `stat`
|
||||
- **Who**: Dom, ClaudeCode
|
||||
- **Why**: `mountinfo.Mounted(path)` from `github.com/moby/sys/mountinfo` works
|
||||
|
||||
Reference in New Issue
Block a user