mirror of
https://github.com/go-sylixos/elvish.git
synced 2024-12-13 09:57:51 +08:00
21 lines
334 B
Go
21 lines
334 B
Go
// +build !windows,!plan9
|
|
|
|
package util
|
|
|
|
import (
|
|
"os/exec"
|
|
"sort"
|
|
"strings"
|
|
)
|
|
|
|
func ls(dir string) []string {
|
|
output, err := exec.Command("ls", dir).Output()
|
|
mustOK(err)
|
|
names := strings.Split(strings.Trim(string(output), "\n"), "\n")
|
|
for i := range names {
|
|
names[i] = dir + names[i]
|
|
}
|
|
sort.Strings(names)
|
|
return names
|
|
}
|