diff options
| author | Ophestra <cat@gensokyo.uk> | 2026-07-07 13:26:58 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2026-07-07 13:26:58 +0900 |
| commit | 810b806a15f0964dec97357e49a17002ecdf65f1 (patch) | |
| tree | 90ffca8a4ff84a0b7429ffe2d57099959785bc76 /cmd/app/app.go | |
| parent | 4a42657d889f11d90a0a0c13bcdd8ef5b6448a83 (diff) | |
cmd/app: omit hidden files
This avoids vim swap files breaking scripts.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'cmd/app/app.go')
| -rw-r--r-- | cmd/app/app.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/cmd/app/app.go b/cmd/app/app.go index 4e4f314d..9679413f 100644 --- a/cmd/app/app.go +++ b/cmd/app/app.go @@ -4,6 +4,7 @@ import ( "bufio" "fmt" "io" + "os" "strconv" "strings" @@ -335,3 +336,19 @@ func parse( return &c, nil } + +// list prints names of non-hidden entries in pathname. +func list(pathname *check.Absolute, dir bool) error { + dents, err := os.ReadDir(pathname.String()) + if err != nil { + return err + } + for _, dent := range dents { + name := dent.Name() + if (dent.IsDir() != dir) || (len(name) > 0 && name[0] == '.') { + continue + } + fmt.Println(dent.Name()) + } + return nil +} |
