refactor builder in kubectl factory

This commit is contained in:
ymqytw
2017-11-07 17:42:03 -08:00
parent 42d5dc709e
commit 06c5be9802
25 changed files with 125 additions and 159 deletions

View File

@@ -132,11 +132,7 @@ func (o *SelectorOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args [
IncludeUninitialized(includeUninitialized).
Flatten()
if !o.local {
o.builder = o.builder.
ResourceTypeOrNameArgs(o.all, o.resources...).
Latest()
} else {
if o.local {
// if a --local flag was provided, and a resource was specified in the form
// <resource>/<name>, fail immediately as --local cannot query the api server
// for the specified resource.
@@ -145,6 +141,10 @@ func (o *SelectorOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args [
}
o.builder = o.builder.Local(f.ClientForMapping)
} else {
o.builder = o.builder.
ResourceTypeOrNameArgs(o.all, o.resources...).
Latest()
}
o.PrintObject = func(obj runtime.Object) error {