Add glob support in subcommands add patch and add configmap

This commit is contained in:
Jingfang Liu
2018-08-01 15:10:46 -07:00
parent 55f8828ba1
commit bf73633cda
7 changed files with 103 additions and 30 deletions

View File

@@ -70,20 +70,10 @@ func (o *addResourceOptions) Complete(cmd *cobra.Command, args []string) error {
// RunAddResource runs addResource command (do real work).
func (o *addResourceOptions) RunAddResource(fsys fs.FileSystem) error {
var resources []string
for _, pattern := range o.resourceFilePaths {
files, err := fsys.Glob(pattern)
if err != nil {
return err
}
if len(files) == 0 {
log.Printf("%s has no match", pattern)
continue
}
resources = append(resources, files...)
resources, err := globPatterns(fsys, o.resourceFilePaths)
if err != nil {
return err
}
if len(resources) == 0 {
return nil
}