allow kubectl cmd to process dirs recursively

reqs:
    - the kubectl cmd must support the -f | --filename flag
    - the kubectl cmd must support visiting a dir one level deep,
    or using more than one resource
This commit is contained in:
Mike Metral
2016-03-28 12:44:21 -07:00
parent e01feae75a
commit 7403878ac0
61 changed files with 438 additions and 82 deletions

View File

@@ -39,6 +39,7 @@ type PauseConfig struct {
Out io.Writer
Filenames []string
Recursive bool
}
const (
@@ -70,6 +71,7 @@ func NewCmdRolloutPause(f *cmdutil.Factory, out io.Writer) *cobra.Command {
usage := "Filename, directory, or URL to a file identifying the resource to get from a server."
kubectl.AddJsonFilenameFlag(cmd, &opts.Filenames, usage)
cmdutil.AddRecursiveFlag(cmd, &opts.Recursive)
return cmd
}
@@ -89,7 +91,7 @@ func (o *PauseConfig) CompletePause(f *cmdutil.Factory, cmd *cobra.Command, out
infos, err := resource.NewBuilder(o.Mapper, o.Typer, resource.ClientMapperFunc(f.ClientForMapping), f.Decoder(true)).
NamespaceParam(cmdNamespace).DefaultNamespace().
FilenameParam(enforceNamespace, o.Filenames...).
FilenameParam(enforceNamespace, o.Recursive, o.Filenames...).
ResourceTypeOrNameArgs(true, args...).
SingleResourceType().
Latest().