cmd/app: omit hidden files
Test / Create distribution (push) Successful in 1m4s
Test / Sandbox (push) Successful in 2m58s
Test / ShareFS (push) Successful in 4m1s
Test / Hakurei (push) Successful in 4m11s
Test / Sandbox (race detector) (push) Successful in 5m37s
Test / Hakurei (race detector) (push) Successful in 6m48s
Test / Flake checks (push) Successful in 1m9s
Test / Create distribution (push) Successful in 1m4s
Test / Sandbox (push) Successful in 2m58s
Test / ShareFS (push) Successful in 4m1s
Test / Hakurei (push) Successful in 4m11s
Test / Sandbox (race detector) (push) Successful in 5m37s
Test / Hakurei (race detector) (push) Successful in 6m48s
Test / Flake checks (push) Successful in 1m9s
This avoids vim swap files breaking scripts. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
|||||||
"bufio"
|
"bufio"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@@ -335,3 +336,19 @@ func parse(
|
|||||||
|
|
||||||
return &c, nil
|
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
|
||||||
|
}
|
||||||
|
|||||||
+2
-23
@@ -7,7 +7,6 @@ package main
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
|
||||||
"io"
|
"io"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
@@ -77,17 +76,7 @@ func main() {
|
|||||||
"enter", "Enter mutable state template",
|
"enter", "Enter mutable state template",
|
||||||
func(args []string) error {
|
func(args []string) error {
|
||||||
if len(args) != 1 {
|
if len(args) != 1 {
|
||||||
dents, err := os.ReadDir(template.String())
|
return list(template, true)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
for _, dent := range dents {
|
|
||||||
if !dent.IsDir() {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
fmt.Println(dent.Name())
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
config := hst.Config{
|
config := hst.Config{
|
||||||
@@ -159,17 +148,7 @@ func main() {
|
|||||||
"run", "Start the named application",
|
"run", "Start the named application",
|
||||||
func(args []string) error {
|
func(args []string) error {
|
||||||
if len(args) < 1 {
|
if len(args) < 1 {
|
||||||
dents, err := os.ReadDir(base.Append("app").String())
|
return list(base.Append("app"), false)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
for _, dent := range dents {
|
|
||||||
if dent.IsDir() {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
fmt.Println(dent.Name())
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var config *hst.Config
|
var config *hst.Config
|
||||||
|
|||||||
Reference in New Issue
Block a user