refactor: delegate -l output to findmnt
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:
2026-05-04 10:24:53 +02:00
parent e6a02e5bf7
commit 4306170626
4 changed files with 45 additions and 49 deletions
-31
View File
@@ -4,7 +4,6 @@
package main
import (
"bytes"
"os"
"path/filepath"
"strings"
@@ -140,36 +139,6 @@ func TestVerifyMountDirRejectsSymlink(t *testing.T) {
}
}
func TestListMountsMissingBase(t *testing.T) {
runtime := t.TempDir()
t.Setenv("XDG_RUNTIME_DIR", runtime)
var buf bytes.Buffer
if err := list_mounts(&buf); err != nil {
t.Fatalf("unexpected error: %v", err)
}
if buf.Len() != 0 {
t.Fatalf("want empty output, got %q", buf.String())
}
}
func TestListMountsFiltersUnmounted(t *testing.T) {
runtime := t.TempDir()
t.Setenv("XDG_RUNTIME_DIR", runtime)
base := filepath.Join(runtime, "sshfs")
for _, name := range []string{"stale1", "stale2"} {
if err := os.MkdirAll(filepath.Join(base, name), 0700); err != nil {
t.Fatalf("setup stale dir: %v", err)
}
}
var buf bytes.Buffer
if err := list_mounts(&buf); err != nil {
t.Fatalf("unexpected error: %v", err)
}
if buf.Len() != 0 {
t.Fatalf("want stale dirs filtered, got %q", buf.String())
}
}
func TestUnmountRejectsBadAlias(t *testing.T) {
runtime := t.TempDir()
t.Setenv("XDG_RUNTIME_DIR", runtime)