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

@@ -238,13 +238,13 @@ func (o *EnvOptions) RunEnv(f cmdutil.Factory) error {
FilenameParam(enforceNamespace, &o.FilenameOptions).
Flatten()
if !o.Local {
if o.Local {
b = b.Local(f.ClientForMapping)
} else {
b = b.
LabelSelectorParam(o.Selector).
ResourceTypeOrNameArgs(o.All, o.From).
Latest()
} else {
b = b.Local(f.ClientForMapping)
}
infos, err := b.Do().Infos()
@@ -302,13 +302,13 @@ func (o *EnvOptions) RunEnv(f cmdutil.Factory) error {
FilenameParam(enforceNamespace, &o.FilenameOptions).
Flatten()
if !o.Local {
if o.Local {
b = b.Local(f.ClientForMapping)
} else {
b = b.
LabelSelectorParam(o.Selector).
ResourceTypeOrNameArgs(o.All, o.Resources...).
Latest()
} else {
b = b.Local(f.ClientForMapping)
}
o.Infos, err = b.Do().Infos()