mirror of
https://github.com/Hopiu/micro.git
synced 2026-03-16 22:10:26 +00:00
31 lines
659 B
Go
31 lines
659 B
Go
package config
|
|
|
|
import (
|
|
"embed"
|
|
"strings"
|
|
)
|
|
|
|
//go:generate go run syntax/make_headers.go syntax
|
|
|
|
//go:embed colorschemes help plugins syntax
|
|
var runtime embed.FS
|
|
|
|
// AssetDir lists file names in folder
|
|
func AssetDir(name string) ([]string, error) {
|
|
name = strings.TrimLeft(name, "runtime/")
|
|
entries, err := runtime.ReadDir(name)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
names := make([]string, len(entries), len(entries))
|
|
for i, entry := range entries {
|
|
names[i] = entry.Name()
|
|
}
|
|
return names, nil
|
|
}
|
|
|
|
// Asset returns a file content
|
|
func Asset(name string) ([]byte, error) {
|
|
name = strings.TrimLeft(name, "runtime/")
|
|
return runtime.ReadFile(name)
|
|
}
|