Skip to content

Commit b3e58cc

Browse files
authored
Merge pull request #1 from zxbyoyoyo/main
Feat: support load *.config files
2 parents 2a84a6e + 5513688 commit b3e58cc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

kube.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ type Candidate struct {
1313
}
1414

1515
// KubeconfigFilenamePattern defines the name pattern of kubeconfig files
16-
var KubeconfigFilenamePattern = regexp.MustCompile("^(.*)\\.kubeconfig$")
16+
var KubeconfigFilenamePattern = regexp.MustCompile("^(.*)\\.(kubeconfig|config)$")
1717

1818
// ListKubeconfigCandidatesInDir lists all files in dir that matches KubeconfigFilenamePattern
1919
func ListKubeconfigCandidatesInDir(dir string) ([]Candidate, error) {
@@ -37,7 +37,7 @@ func ListKubeconfigCandidatesInDir(dir string) ([]Candidate, error) {
3737
}
3838

3939
matches := KubeconfigFilenamePattern.FindStringSubmatch(file.Name())
40-
if len(matches) == 2 {
40+
if len(matches) >= 2 {
4141
files = append(files, Candidate{
4242
Name: matches[1],
4343
FullPath: path.Join(dir, file.Name()),

0 commit comments

Comments
 (0)