mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 23:47:50 +00:00
Add directory as option for createall command
This commit is contained in:
@@ -21,6 +21,7 @@ import (
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
@@ -92,6 +93,21 @@ func FirstNonEmptyString(args ...string) string {
|
||||
return ""
|
||||
}
|
||||
|
||||
// Return a list of file names of a certain type within a given directory.
|
||||
func GetFilesFromDir(directory string, fileType string) []string {
|
||||
files := []string{}
|
||||
|
||||
err := filepath.Walk(directory, func(path string, f os.FileInfo, err error) error {
|
||||
if filepath.Ext(path) == fileType {
|
||||
files = append(files, path)
|
||||
}
|
||||
return err
|
||||
})
|
||||
|
||||
checkErr(err)
|
||||
return files
|
||||
}
|
||||
|
||||
// ReadConfigData reads the bytes from the specified filesytem or network
|
||||
// location or from stdin if location == "-".
|
||||
func ReadConfigData(location string) ([]byte, error) {
|
||||
|
||||
Reference in New Issue
Block a user