edit: Make environment variables composable

It also adds support for KUBE_EDITOR and GIT_EDITOR which were already
advertised in the edit usage message.
This commit is contained in:
kargakis
2015-11-11 12:29:52 +01:00
committed by Michail Kargakis
parent a7425bf070
commit 523b6ec7e3
5 changed files with 27 additions and 12 deletions

View File

@@ -101,6 +101,10 @@ type Factory struct {
CanBeAutoscaled func(kind string) error
// AttachablePodForObject returns the pod to which to attach given an object.
AttachablePodForObject func(object runtime.Object) (*api.Pod, error)
// EditorEnvs returns a group of environment variables that the edit command
// can range over in order to determine if the user has specified an editor
// of their choice.
EditorEnvs func() []string
}
// NewFactory creates a factory with the default Kubernetes resources defined
@@ -331,6 +335,9 @@ func NewFactory(optionalClientConfig clientcmd.ClientConfig) *Factory {
return nil, fmt.Errorf("cannot attach to %s: not implemented", kind)
}
},
EditorEnvs: func() []string {
return []string{"KUBE_EDITOR", "EDITOR"}
},
}
}